/* ==========================================================================
   คณะสหเวชศาสตร์ มหาวิทยาลัยราชภัฏบ้านสมเด็จเจ้าพระยา
   ระบบดีไซน์ — โทนโมเดิร์น สดใส เน้นผู้ชมวัยรุ่น
   สีประจำคณะ #ed74a4 + ไล่เฉดม่วง/ส้มปะการัง
   ========================================================================== */

:root {
    /* ---- สีหลัก ---- */
    --pink:          #ed74a4;
    --pink-600:      #e04d8c;
    --pink-700:      #c93b76;
    --pink-800:      #a52d60;
    --pink-300:      #f5a3c3;
    --pink-200:      #fac8dc;
    --pink-100:      #fce4ee;
    --pink-50:       #fdf3f7;

    /* ---- สีเสริม (ใช้น้อย เน้นให้ชมพูประจำคณะเป็นตัวหลัก) ---- */
    --rose:          #f9a8c9;
    --gold:          #f0b429;

    /* ---- สีกลาง ---- */
    --plum:          #3f1c2f;
    --ink:           #2c2129;
    --ink-soft:      #5f5560;
    --ink-faint:     #8c8390;
    --line:          #f0e3ea;
    --surface:       #ffffff;
    --surface-alt:   #fbf6f9;

    /* ---- ไล่เฉดสี — ใช้เฉดของชมพูประจำคณะเท่านั้น และใช้เฉพาะจุดใหญ่ ---- */
    --grad-brand:    linear-gradient(115deg, #f7a8c8 0%, #ed74a4 48%, #c93b76 100%);
    --grad-soft:     linear-gradient(120deg, #fff4f8 0%, #fdf3f7 50%, #fdeaf2 100%);
    --grad-dark:     linear-gradient(135deg, #3f1c2f 0%, #8e2f60 58%, #c93b76 100%);
    /* ไล่เฉดเข้มพอให้ตัวอักษรสีขาวอ่านง่าย ใช้กับกล่องชวนสมัคร */
    --grad-cta:      linear-gradient(115deg, #d1356f 0%, #a52d60 48%, #55203a 100%);
    --grad-line:     linear-gradient(90deg, var(--pink-300), var(--pink-700));

    /* ---- เงา ---- */
    --shadow-sm:     0 1px 3px rgba(63, 28, 47, .07), 0 1px 2px rgba(63, 28, 47, .04);
    --shadow:        0 6px 22px rgba(63, 28, 47, .10);
    --shadow-lg:     0 18px 48px rgba(63, 28, 47, .16);
    --shadow-pink:   0 10px 30px rgba(224, 77, 140, .32);
    --shadow-glow:   0 0 0 1px rgba(237, 116, 164, .18), 0 20px 46px rgba(224, 77, 140, .26);

    /* ---- มุมโค้ง ---- */
    --radius:        18px;
    --radius-sm:     12px;
    --radius-lg:     26px;
    --radius-xl:     34px;

    /* ---- จังหวะการเคลื่อนไหว ---- */
    --ease:          cubic-bezier(.22, 1, .36, 1);
    --ease-spring:   cubic-bezier(.34, 1.56, .64, 1);

    --container:     1180px;
    --header-h:      84px;
}

/* ==========================================================================
   คีย์เฟรมกลาง
   ========================================================================== */

@keyframes ahs-float {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50%      { transform: translate3d(0, -18px, 0); }
}
@keyframes ahs-blob {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    33%  { transform: translate3d(28px, -22px, 0) scale(1.08); }
    66%  { transform: translate3d(-20px, 18px, 0) scale(.94); }
    100% { transform: translate3d(0, 0, 0) scale(1); }
}
@keyframes ahs-pan {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes ahs-marquee {
    from { transform: translate3d(0, 0, 0); }
    to   { transform: translate3d(-50%, 0, 0); }
}
@keyframes ahs-shine {
    from { transform: translate3d(-120%, 0, 0) rotate(18deg); }
    to   { transform: translate3d(320%, 0, 0) rotate(18deg); }
}
@keyframes ahs-kenburns {
    from { transform: scale(1.02) translate3d(0, 0, 0); }
    to   { transform: scale(1.16) translate3d(-1.2%, -1.4%, 0); }
}
@keyframes ahs-pulse-ring {
    0%   { box-shadow: 0 0 0 0 rgba(237, 116, 164, .45); }
    70%  { box-shadow: 0 0 0 16px rgba(237, 116, 164, 0); }
    100% { box-shadow: 0 0 0 0 rgba(237, 116, 164, 0); }
}
@keyframes ahs-bob-y {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50%      { transform: translate3d(0, 9px, 0); }
}
@keyframes ahs-spin {
    to { transform: rotate(360deg); }
}
@keyframes ahs-pop {
    0%   { opacity: 0; transform: scale(.82); }
    60%  { opacity: 1; transform: scale(1.04); }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes ahs-rise {
    from { opacity: 0; transform: translate3d(0, 26px, 0); }
    to   { opacity: 1; transform: none; }
}
@keyframes ahs-sheen {
    0%   { background-position: -260% 0; }
    100% { background-position: 260% 0; }
}

/* ==========================================================================
   พื้นฐาน
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 24px);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: 'Noto Sans Thai', 'Sarabun', 'Segoe UI', system-ui, sans-serif;
    font-size: 16.5px;
    line-height: 1.78;
    color: var(--ink);
    background: var(--surface);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ทุกรูปในหน้าเว็บระบุ width/height ไว้ในแท็กเพื่อให้เบราว์เซอร์กันพื้นที่ไว้ล่วงหน้า (ลดอาการหน้ากระตุก)
   height: auto จึงจำเป็น ไม่งั้นรูปที่ถูกย่อตามความกว้างจะยังใช้ความสูงตามแอตทริบิวต์และภาพยืด
   (กฎที่เจาะจงกว่า เช่น .hero__slide img หรือ .brand__logo ยังกำหนดความสูงของตัวเองได้ตามเดิม) */
img { max-width: 100%; height: auto; display: block; }

a { color: var(--pink-700); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--pink-800); }

h1, h2, h3, h4 { line-height: 1.32; margin: 0 0 .6em; font-weight: 700; color: var(--plum); letter-spacing: -.4px; }
h1 { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 3rem); }
h2 { font-size: clamp(1.5rem, 1.15rem + 1.5vw, 2.1rem); }
h3 { font-size: 1.22rem; }
h4 { font-size: 1.05rem; }
p  { margin: 0 0 1.1em; }

ul, ol { margin: 0 0 1.1em; padding-left: 1.35em; }
li { margin-bottom: .4em; }

::selection { background: var(--pink-200); color: var(--plum); }

:focus-visible {
    outline: 3px solid var(--pink-700);
    outline-offset: 3px;
    border-radius: 6px;
}

.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: 20px;
}

.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ลิงก์ "ข้ามไปยังเนื้อหาหลัก" — ซ่อนไว้เหนือจอ เลื่อนลงมาให้เห็นเมื่อถูกโฟกัสด้วยปุ่ม Tab */
.skip-link {
    position: fixed; top: 0; left: 50%; z-index: 999;
    transform: translate(-50%, -120%);
    padding: 12px 24px; border-radius: 0 0 12px 12px;
    background: var(--pink-600); color: #fff; font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
    transition: transform .25s var(--ease);
}
.skip-link:focus {
    transform: translate(-50%, 0);
    color: #fff; outline: 3px solid var(--plum); outline-offset: 2px;
}
/* ปลายทางของลิงก์รับโฟกัสได้ (tabindex="-1") แต่ไม่ต้องขึ้นกรอบให้รกสายตา */
main:focus { outline: none; }

/* ตัวอักษรไล่เฉดสี */
.grad-text {
    background: var(--grad-brand);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: ahs-pan 9s ease-in-out infinite;
}

/* ก้อนสีเบลอลอยเป็นฉากหลัง */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: .5;
    pointer-events: none;
    animation: ahs-blob 18s ease-in-out infinite;
    will-change: transform;
}
.blob--pink   { background: radial-gradient(circle, #ff8ec0, transparent 70%); }
.blob--rose { background: radial-gradient(circle, #f19cc0, transparent 70%); animation-duration: 24s; animation-delay: -6s; }
.blob--plum  { background: radial-gradient(circle, #d98cb0, transparent 70%); animation-duration: 21s; animation-delay: -12s; }

/* ==========================================================================
   แถบแสดงความคืบหน้าการเลื่อนหน้า
   ========================================================================== */

.progressbar {
    position: fixed; inset: 0 auto auto 0; z-index: 130;
    height: 3px; width: 100%;
    transform: scaleX(0); transform-origin: 0 50%;
    background: var(--pink-600);
    box-shadow: 0 0 12px rgba(237, 116, 164, .7);
    pointer-events: none;
}

/* ==========================================================================
   แถบบนสุด
   ========================================================================== */

.topbar {
    background: var(--grad-dark);
    background-size: 180% 100%;
    animation: ahs-pan 16s ease-in-out infinite;
    color: rgba(255, 255, 255, .82);
    font-size: .84rem;
}
.topbar .container {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; min-height: 38px; flex-wrap: wrap;
}
.topbar__info { display: flex; gap: 20px; flex-wrap: wrap; }
.topbar__info span { display: inline-flex; align-items: center; gap: 7px; }
.topbar__links { display: flex; gap: 18px; }
.topbar__links a { display: inline-flex; align-items: center; gap: 7px; }
.topbar a { color: rgba(255, 255, 255, .82); }
.topbar a:hover { color: #fff; }
.topbar svg { width: 15px; height: 15px; flex: none; opacity: .8; }

/* ==========================================================================
   ส่วนหัวและเมนู
   ========================================================================== */

.header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(14px) saturate(150%);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
    border-bottom: 1px solid transparent;
    transition: box-shadow .3s var(--ease), background .3s var(--ease), border-color .3s var(--ease);
}
.header::after {
    content: ''; position: absolute; inset: auto 0 -1px 0; height: 1px;
    background: var(--grad-line); opacity: 0;
    transition: opacity .3s var(--ease);
}
.header.is-stuck {
    background: rgba(255, 255, 255, .93);
    box-shadow: 0 10px 30px rgba(63, 28, 47, .10);
}
.header.is-stuck::after { opacity: .55; }
.header .container {
    display: flex; align-items: center; justify-content: space-between;
    gap: 20px; min-height: var(--header-h);
    transition: min-height .3s var(--ease);
}
.header.is-stuck .container { min-height: 70px; }

.brand { display: flex; align-items: center; gap: 12px; color: inherit; flex: none; }
.brand__logo {
    height: 56px; width: auto; flex: none;
    transition: transform .45s var(--ease-spring), height .3s var(--ease);
}
.brand:hover .brand__logo { transform: rotate(-6deg) scale(1.06); }
.header.is-stuck .brand__logo { height: 48px; }
.brand__text { display: flex; flex-direction: column; }
.brand__name {
    font-weight: 700; font-size: 1.42rem; color: var(--plum);
    line-height: 1.2; letter-spacing: -.4px;
}
.brand__sub { font-size: .8rem; color: var(--ink-faint); line-height: 1.35; white-space: nowrap; }

.nav { display: flex; align-items: center; }
.nav__list { display: flex; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav__item { position: relative; }
.nav__link {
    position: relative;
    display: inline-flex; align-items: center; gap: 5px;
    padding: 10px 10px; border-radius: 999px;
    font-size: .91rem; font-weight: 500; color: var(--ink);
    white-space: nowrap;
    transition: color .22s var(--ease), background .22s var(--ease), transform .22s var(--ease-spring);
}
.nav__link::before {
    content: ''; position: absolute; inset: 0; border-radius: 999px;
    background: var(--pink-700); opacity: 0; transform: scale(.7);
    transition: opacity .25s var(--ease), transform .3s var(--ease-spring), background .2s var(--ease);
    z-index: -1;
}
/* ข้อความชมพูบนพื้นชมพูอ่อนอ่านยาก (pink-700 บน pink-50 ≈ 4.4:1 พอดีเส้น) จึงใช้คู่สีเข้มขึ้นให้ contrast สูงพอ (pink-800 บน pink-100 ≈ 5.6:1) */
.nav__link:hover,
.nav__item:hover > .nav__link { color: var(--pink-800); background: var(--pink-100); transform: translateY(-2px); }
.nav__link.is-active { color: #fff; }
.nav__link.is-active::before { opacity: 1; transform: scale(1); }
.nav__link.is-active:hover { color: #fff; }
.nav__link.is-active:hover::before { background: var(--pink-800); }
.nav__link svg { width: 12px; height: 12px; opacity: .6; transition: transform .3s var(--ease-spring); }
.nav__item:hover > .nav__link svg { transform: rotate(180deg); }

.nav__sub {
    position: absolute; top: calc(100% + 10px); left: 0;
    min-width: 280px; padding: 10px; margin: 0; list-style: none;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    opacity: 0; visibility: hidden; transform: translateY(-10px) scale(.97);
    transform-origin: top left;
    transition: opacity .25s var(--ease), transform .3s var(--ease-spring), visibility .25s;
}
/* เส้นไล่สีบาง ๆ ที่ขอบบนแผง ผูกภาษาภาพเดียวกับเส้นใต้ส่วนหัวตอนเลื่อน (.header::after) */
.nav__sub::after {
    content: ''; position: absolute; inset: 0 0 auto 0; height: 3px;
    background: var(--grad-line);
}
.nav__sub::before {
    content: ''; position: absolute; inset: -10px 0 auto 0; height: 10px;
}
.nav__item:hover > .nav__sub,
.nav__item:focus-within > .nav__sub { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.nav__sub a {
    position: relative; isolation: isolate;
    display: block; padding: 10px 14px 10px 20px; border-radius: var(--radius-sm);
    font-size: .93rem; color: var(--ink);
    transition: background .2s var(--ease), color .2s var(--ease);
}
/* แถบสีซ้ายค่อย ๆ ขยายเข้ามาแทนการเลื่อนข้อความล้วน ๆ — โมเดิร์นและยังอ่านตัวอักษรง่ายกว่าเดิม */
.nav__sub a::before {
    content: ''; position: absolute; left: 6px; top: 50%; z-index: -1;
    width: 3px; height: 0; border-radius: 999px;
    background: var(--grad-line);
    transform: translateY(-50%);
    transition: height .22s var(--ease);
}
.nav__sub a:hover { background: var(--pink-100); color: var(--pink-800); }
.nav__sub a:hover::before { height: 60%; }
/* ไฮไลต์รายการที่ตรงกับหน้าปัจจุบัน เมื่อเปิดดรอปดาวน์ดู */
.nav__sub a.is-active { background: var(--pink-50); color: var(--pink-800); font-weight: 600; }
.nav__sub a.is-active::before { height: 60%; }

/* ปุ่มสมัครเรียนในแถบเมนู */
.nav__item--cta { margin-left: 10px; }
.nav__item--cta .btn { padding: 10px 20px; }

.nav-toggle {
    display: none; width: 46px; height: 46px;
    background: #fff; border: 1px solid var(--line); border-radius: 14px;
    cursor: pointer; color: var(--plum); place-items: center;
    box-shadow: var(--shadow-sm);
    transition: transform .3s var(--ease-spring), border-color .2s var(--ease);
}
.nav-toggle:active { transform: scale(.92); }
.nav-toggle[aria-expanded="true"] { border-color: var(--pink-300); color: var(--pink-700); }
.nav-toggle svg { width: 22px; height: 22px; }

/* ==========================================================================
   ปุ่ม
   ========================================================================== */

.btn {
    position: relative; overflow: hidden; isolation: isolate;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 26px; border: 1px solid transparent; border-radius: 999px;
    font: inherit; font-size: .95rem; font-weight: 600; cursor: pointer;
    white-space: nowrap;
    transition: transform .28s var(--ease-spring), box-shadow .28s var(--ease),
                background .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
}
.btn::after {
    content: ''; position: absolute; top: -60%; left: 0; z-index: -1;
    width: 40%; height: 220%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
    transform: translate3d(-120%, 0, 0) rotate(18deg);
}
.btn:hover { transform: translateY(-3px); }
.btn:hover::after { animation: ahs-shine .9s var(--ease) forwards; }
.btn:active { transform: translateY(-1px) scale(.98); }
.btn svg { width: 17px; height: 17px; flex: none; transition: transform .3s var(--ease-spring); }
.btn:hover svg { transform: translateX(4px); }

.btn--primary {
    background: var(--pink-600);
    color: #fff; box-shadow: var(--shadow-pink);
}
.btn--primary:hover { background: var(--pink-700); color: #fff; box-shadow: 0 14px 34px rgba(224, 77, 140, .45); }

.btn--outline { background: #fff; color: var(--pink-700); border-color: var(--pink-200); }
.btn--outline:hover { background: var(--pink-50); color: var(--pink-800); border-color: var(--pink); box-shadow: 0 10px 24px rgba(224, 77, 140, .2); }

.btn--ghost-light {
    background: rgba(255, 255, 255, .14); color: #fff;
    border-color: rgba(255, 255, 255, .45);
    backdrop-filter: blur(8px);
}
.btn--ghost-light:hover { background: #fff; color: var(--pink-700); box-shadow: 0 12px 30px rgba(0, 0, 0, .22); }

.btn--sm { padding: 9px 18px; font-size: .88rem; }

/* ==========================================================================
   สไลด์แบนเนอร์หน้าแรก
   ========================================================================== */

.hero {
    position: relative;
    background: var(--plum);
    overflow: hidden;
    isolation: isolate;
}
.hero__track { position: relative; height: clamp(500px, 74vh, 660px); }
.hero__slide {
    position: absolute; inset: 0;
    opacity: 0; visibility: hidden;
    transition: opacity 1s var(--ease), visibility 1s;
}
.hero__slide.is-active { opacity: 1; visibility: visible; }
.hero__slide img {
    width: 100%; height: 100%; object-fit: cover;
    transform: scale(1.02);
}
.hero__slide.is-active img { animation: ahs-kenburns 9s linear forwards; }

.hero__overlay {
    position: absolute; inset: 0;
    background:
        radial-gradient(120% 90% at 12% 20%, rgba(165, 45, 96, .55) 0%, transparent 62%),
        radial-gradient(90% 80% at 88% 88%, rgba(201, 59, 118, .45) 0%, transparent 64%),
        linear-gradient(100deg, rgba(32, 11, 23, .92) 0%, rgba(32, 11, 23, .7) 52%, rgba(32, 11, 23, .38) 100%);
}
/* ลายจุดบาง ๆ ให้ดูมีมิติ */
.hero__overlay::after {
    content: ''; position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, .16) 1px, transparent 1px);
    background-size: 22px 22px;
    opacity: .35;
    mask-image: linear-gradient(100deg, transparent 35%, #000 100%);
    -webkit-mask-image: linear-gradient(100deg, transparent 35%, #000 100%);
}

.hero__decor { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.hero__decor .blob { opacity: .38; }
.hero__decor .blob--pink   { width: 380px; height: 380px; left: -90px; bottom: -110px; }
.hero__decor .blob--rose { width: 440px; height: 440px; right: -120px; top: -140px; }
.hero__decor .blob--plum  { width: 260px; height: 260px; right: 26%; bottom: -90px; }

.hero__content {
    position: absolute; inset: 0; z-index: 2;
    display: grid; align-content: center;
    max-width: var(--container); margin-inline: auto; padding: 0 20px 40px;
    color: #fff;
}
.hero__eyebrow {
    display: inline-flex; align-items: center; gap: 9px; width: fit-content;
    padding: 8px 18px; margin-bottom: 20px; border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .3);
    backdrop-filter: blur(10px);
    font-size: .84rem; font-weight: 500; letter-spacing: .4px;
    line-height: 1.5; white-space: nowrap;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .16);
}
.hero__eyebrow svg { width: 17px; height: 17px; flex: none; opacity: .95; }
.hero__title {
    margin: 0 0 14px; color: #fff; font-weight: 700;
    font-size: clamp(2rem, 1.2rem + 3.6vw, 3.5rem);
    line-height: 1.16; letter-spacing: -1px;
    max-width: 18ch;
    text-shadow: 0 4px 26px rgba(0, 0, 0, .32);
}
.hero__text {
    margin: 0 0 30px; max-width: 46ch;
    font-size: clamp(1rem, .95rem + .3vw, 1.15rem);
    color: rgba(255, 255, 255, .92);
}
.hero__actions { display: flex; gap: 13px; flex-wrap: wrap; }

/* เนื้อหาในสไลด์ทยอยปรากฏ
   ใช้ transition ผูกกับสถานะ is-active (ไม่ใช่ animation แบบ fill)
   เพื่อให้ข้อความยังคงมองเห็นเสมอแม้แอนิเมชันไม่ทำงาน */
.js .hero__slide .hero__eyebrow,
.js .hero__slide .hero__title,
.js .hero__slide .hero__text,
.js .hero__slide .hero__actions {
    opacity: 0; transform: translate3d(0, 30px, 0);
    transition: opacity .8s var(--ease), transform .9s var(--ease);
}
.js .hero__slide.is-active .hero__eyebrow,
.js .hero__slide.is-active .hero__title,
.js .hero__slide.is-active .hero__text,
.js .hero__slide.is-active .hero__actions { opacity: 1; transform: none; }
.js .hero__slide.is-active .hero__eyebrow  { transition-delay: .15s; }
.js .hero__slide.is-active .hero__title    { transition-delay: .27s; }
.js .hero__slide.is-active .hero__text     { transition-delay: .39s; }
.js .hero__slide.is-active .hero__actions  { transition-delay: .51s; }

/* วางจุดบอกสไลด์ให้สูงกว่าการ์ดทางลัดที่เหลื่อมขึ้นมาทับ */
.hero__dots {
    position: absolute; left: 50%; bottom: 74px; transform: translateX(-50%);
    display: flex; gap: 10px; z-index: 4;
}
.hero__dots button {
    position: relative; overflow: hidden;
    width: 42px; height: 5px; padding: 0; border: 0; border-radius: 999px;
    background: rgba(255, 255, 255, .35); cursor: pointer;
    transition: width .35s var(--ease-spring), background .3s var(--ease);
}
.hero__dots button:hover { background: rgba(255, 255, 255, .6); }
.hero__dots button.is-active { width: 62px; background: rgba(255, 255, 255, .35); }
.hero__dots button.is-active::after {
    content: ''; position: absolute; inset: 0;
    background: #fff; border-radius: 999px;
    transform-origin: 0 50%;
    animation: hero-dot 6s linear forwards;
}
@keyframes hero-dot { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.hero__arrow {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 4;
    width: 48px; height: 48px; display: grid; place-items: center;
    background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .3);
    backdrop-filter: blur(8px);
    border-radius: 50%; color: #fff; cursor: pointer;
    transition: background .25s var(--ease), transform .3s var(--ease-spring);
}
.hero__arrow:hover { background: rgba(255, 255, 255, .3); transform: translateY(-50%) scale(1.12); }
.hero__arrow--prev { left: 20px; }
.hero__arrow--next { right: 20px; }
.hero__arrow svg { width: 20px; height: 20px; }

/* ตัวชี้ให้เลื่อนลง — วางชิดขวาเพื่อไม่ให้ชนกับจุดบอกสไลด์ */
.hero__scroll {
    position: absolute; right: 30px; bottom: 74px; z-index: 4;
    display: grid; place-items: center; gap: 6px;
    color: rgba(255, 255, 255, .85); font-size: .72rem; letter-spacing: 1.4px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, .5);
    animation: ahs-bob-y 2.4s ease-in-out infinite;
}
.hero__scroll span {
    display: block; width: 24px; height: 38px; border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, .5); position: relative;
}
.hero__scroll span::after {
    content: ''; position: absolute; left: 50%; top: 8px;
    width: 4px; height: 8px; margin-left: -2px; border-radius: 999px; background: #fff;
    animation: hero-wheel 1.8s ease-in-out infinite;
}
@keyframes hero-wheel {
    0%   { opacity: 0; transform: translateY(0); }
    35%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(12px); }
}

/* ==========================================================================
   แถบข้อความวิ่ง
   ========================================================================== */

.marquee {
    position: relative; overflow: hidden;
    padding: 15px 0;
    background: var(--grad-brand); background-size: 200% 100%;
    animation: ahs-pan 14s ease-in-out infinite;
    color: #fff;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee__track {
    display: flex; width: max-content; gap: 0;
    animation: ahs-marquee 34s linear infinite;
    will-change: transform;
}
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__group { display: flex; align-items: center; gap: 34px; padding-right: 34px; }
.marquee__item {
    display: inline-flex; align-items: center; gap: 12px;
    font-size: 1.02rem; font-weight: 600; white-space: nowrap; letter-spacing: .2px;
}
.marquee__item::after {
    content: ''; width: 7px; height: 7px; border-radius: 50%;
    background: rgba(255, 255, 255, .75);
}

/* ==========================================================================
   แถบทางลัด (bento)
   ========================================================================== */

.quicklinks {
    position: relative; z-index: 3;
    margin-top: -46px; padding-bottom: 54px;
}
.quicklinks__grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
.quicklinks__item {
    position: relative; overflow: hidden;
    display: flex; align-items: center; gap: 14px;
    padding: 22px 22px; border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, .9);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, .8);
    box-shadow: var(--shadow-lg);
    color: var(--plum);
    transition: transform .35s var(--ease-spring), box-shadow .35s var(--ease), color .3s var(--ease);
}
.quicklinks__item::before {
    content: ''; position: absolute; inset: 0; z-index: -1;
    background: var(--pink-600); opacity: 0;
    transition: opacity .35s var(--ease);
}
.quicklinks__item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-glow);
    color: #fff;
}
.quicklinks__item:hover::before { opacity: 1; }
.quicklinks__item > * { position: relative; z-index: 1; }
.quicklinks__item svg {
    width: 26px; height: 26px; flex: none;
    padding: 0; color: var(--pink-600);
    transition: transform .45s var(--ease-spring), color .3s var(--ease);
}
.quicklinks__item:hover svg { color: #fff; transform: scale(1.18) rotate(-8deg); }
.quicklinks__item b { display: block; font-weight: 700; font-size: 1rem; line-height: 1.45; }
.quicklinks__item > span > span { font-size: .84rem; color: var(--ink-faint); transition: color .3s var(--ease); }
.quicklinks__item:hover > span > span { color: rgba(255, 255, 255, .88); }

/* ==========================================================================
   โครงสร้างส่วนเนื้อหา
   ========================================================================== */

.section { position: relative; padding: 88px 0; }
.section--alt { background: var(--grad-soft); }
.section--tight { padding: 58px 0; }

/* ฉากหลังก้อนสีลอย ใช้กับ section ที่ต้องการ */
.section--glow { overflow: hidden; }
.section--glow::before,
.section--glow::after {
    content: ''; position: absolute; border-radius: 50%;
    filter: blur(80px); opacity: .38; pointer-events: none;
    animation: ahs-blob 22s ease-in-out infinite;
}
.section--glow::before {
    width: 380px; height: 380px; left: -140px; top: 40px;
    background: radial-gradient(circle, #ffb0d0, transparent 70%);
}
.section--glow::after {
    width: 420px; height: 420px; right: -160px; bottom: 0;
    background: radial-gradient(circle, #f5b8d3, transparent 70%);
    animation-delay: -9s;
}
.section > .container { position: relative; z-index: 1; }

.section__head { margin-bottom: 44px; }
.section__head--center { text-align: center; }
.section__head--center .section__title::after { margin-inline: auto; }
.section__head--row {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 20px; flex-wrap: wrap;
}
.section__eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    margin-bottom: 12px; padding: 6px 15px; border-radius: 999px;
    background: var(--pink-100); color: var(--pink-800);
    font-size: .78rem; font-weight: 700; letter-spacing: 1.4px;
    text-transform: uppercase;
}
.section__eyebrow::before {
    content: ''; width: 7px; height: 7px; border-radius: 50%;
    background: var(--pink-600);
    animation: ahs-pulse-ring 2.6s ease-out infinite;
}
.section__title { margin: 0; font-size: clamp(1.55rem, 1.15rem + 1.7vw, 2.25rem); }
.section__title::after {
    content: ''; display: block; width: 68px; height: 5px; margin-top: 16px;
    background: var(--grad-line); background-size: 200% 100%;
    border-radius: 999px;
    animation: ahs-pan 6s ease-in-out infinite;
}
.section__desc { margin: 16px 0 0; max-width: 62ch; color: var(--ink-soft); }
.section__head--center .section__desc { margin-inline: auto; }

/* ==========================================================================
   ตารางการ์ด
   ========================================================================== */

.grid { display: grid; gap: 26px; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }

/* ---- การ์ดหลักสูตร ---- */

.pcard {
    position: relative; isolation: isolate;
    display: flex; flex-direction: column; overflow: hidden;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); color: inherit;
    transform-style: preserve-3d;
    transition: transform .4s var(--ease), box-shadow .4s var(--ease), border-color .4s var(--ease);
}
/* ขอบไล่เฉดสีเรืองตอนชี้ */
.pcard::before {
    content: ''; position: absolute; inset: -1px; z-index: -1;
    border-radius: inherit; background: var(--grad-brand);
    opacity: 0; transition: opacity .4s var(--ease);
}
.pcard:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-glow);
    border-color: transparent;
    color: inherit;
}
.pcard:hover::before { opacity: 1; }
.pcard__media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; }
.pcard__media::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(63, 28, 47, .5), transparent 55%);
    opacity: 0; transition: opacity .4s var(--ease);
}
.pcard:hover .pcard__media::after { opacity: 1; }
.pcard__media img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .7s var(--ease);
}
.pcard:hover .pcard__media img { transform: scale(1.09); }
.pcard__badge {
    position: absolute; top: 14px; left: 14px; z-index: 2;
    padding: 6px 14px; border-radius: 999px;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(6px);
    color: var(--plum);
    font-size: .78rem; font-weight: 700;
    box-shadow: var(--shadow-sm);
    transition: transform .35s var(--ease-spring);
}
.pcard:hover .pcard__badge { transform: translateY(-3px) scale(1.05); }
.pcard__body {
    position: relative; z-index: 1;
    padding: 24px 24px 26px; flex: 1;
    display: flex; flex-direction: column;
    background: #fff; border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.pcard__title { margin: 0 0 10px; font-size: 1.14rem; transition: color .3s var(--ease); }
.pcard:hover .pcard__title { color: var(--pink-700); }
.pcard__text { margin: 0 0 20px; flex: 1; font-size: .93rem; color: var(--ink-soft); line-height: 1.72; }
.pcard__more {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: .92rem; font-weight: 600; color: var(--pink-700);
}
.pcard__more svg { width: 15px; height: 15px; transition: transform .35s var(--ease-spring); }
.pcard:hover .pcard__more svg { transform: translateX(6px); }

/* ---- การ์ดข่าว ---- */

.ncard {
    display: flex; flex-direction: column; overflow: hidden;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); color: inherit;
    transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s var(--ease);
}
.ncard:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--pink-200);
    color: inherit;
}
.ncard__media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; }
.ncard__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.ncard:hover .ncard__media img { transform: scale(1.07) rotate(.6deg); }
.ncard__body { padding: 20px 22px 24px; flex: 1; display: flex; flex-direction: column; }
.ncard__meta { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.ncard__title { margin: 0 0 10px; font-size: 1.05rem; line-height: 1.5; transition: color .3s var(--ease); }
.ncard:hover .ncard__title { color: var(--pink-700); }
.ncard__text { margin: 0; font-size: .9rem; color: var(--ink-soft); flex: 1; }

.tag {
    display: inline-block; padding: 4px 13px; border-radius: 999px;
    background: var(--pink-100); color: var(--pink-800);
    font-size: .76rem; font-weight: 600;
    transition: background .25s var(--ease), color .25s var(--ease);
}
.ncard:hover .tag, .nrow:hover .tag { background: var(--pink-600); color: #fff; }
.date { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--ink-faint); }
.date svg { width: 14px; height: 14px; }

/* ---- ข่าวแบบแถว ---- */

.nlist { display: grid; gap: 16px; }
.nrow {
    position: relative; overflow: hidden;
    display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: center;
    padding: 16px; background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius); color: inherit;
    transition: border-color .3s var(--ease), box-shadow .3s var(--ease), transform .35s var(--ease);
}
.nrow::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--pink-600);
    transform: scaleY(0); transform-origin: 50% 0;
    transition: transform .35s var(--ease);
}
.nrow:hover {
    border-color: var(--pink-200); box-shadow: var(--shadow-lg);
    transform: translateX(6px); color: inherit;
}
.nrow:hover::before { transform: scaleY(1); }
.nrow__media { aspect-ratio: 16 / 10; border-radius: var(--radius-sm); overflow: hidden; }
.nrow__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.nrow:hover .nrow__media img { transform: scale(1.07); }
.nrow__title { margin: 9px 0 8px; font-size: 1.1rem; transition: color .3s var(--ease); }
.nrow:hover .nrow__title { color: var(--pink-700); }
.nrow__text { margin: 0; font-size: .92rem; color: var(--ink-soft); }

/* ---- อัลบั้มภาพ ---- */

.gcard {
    position: relative; display: block; overflow: hidden;
    border-radius: var(--radius); box-shadow: var(--shadow-sm); color: #fff;
    transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.gcard:hover { transform: translateY(-8px) scale(1.015); box-shadow: var(--shadow-glow); color: #fff; }
.gcard img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .7s var(--ease); }
.gcard:hover img { transform: scale(1.1); }
.gcard__overlay {
    position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
    padding: 20px;
    background: linear-gradient(to top, rgba(44, 21, 33, .92) 0%, rgba(44, 21, 33, .34) 46%, transparent 76%);
    transition: background .4s var(--ease);
}
.gcard:hover .gcard__overlay {
    background: linear-gradient(to top, rgba(165, 45, 96, .92) 0%, rgba(124, 58, 237, .38) 55%, transparent 85%);
}
.gcard__title {
    margin: 0 0 6px; color: #fff; font-size: 1.02rem; line-height: 1.45;
    transition: transform .4s var(--ease-spring);
}
.gcard:hover .gcard__title { transform: translateY(-3px); }
.gcard__meta { font-size: .83rem; opacity: .88; display: flex; gap: 12px; flex-wrap: wrap; }

.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.photo-grid img {
    width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
    border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
    transition: transform .5s var(--ease);
}
.photo-item {
    position: relative; overflow: hidden; border-radius: var(--radius-sm);
    transition: transform .4s var(--ease-spring), box-shadow .4s var(--ease);
}
.photo-item:hover { transform: translateY(-5px) scale(1.02); box-shadow: var(--shadow-lg); z-index: 2; }
.photo-item:hover img { transform: scale(1.08); }
.photo-item figcaption {
    position: absolute; inset: auto 0 0 0; padding: 26px 14px 12px;
    background: linear-gradient(to top, rgba(44, 21, 33, .88), transparent);
    color: #fff; font-size: .85rem;
    transform: translateY(6px); opacity: .92;
    transition: transform .4s var(--ease), opacity .4s var(--ease);
}
.photo-item:hover figcaption { transform: none; opacity: 1; }

/* ==========================================================================
   สารจากคณบดี
   ========================================================================== */

.dean { display: grid; grid-template-columns: 340px 1fr; gap: 56px; align-items: center; }
.dean__photo { position: relative; }
.dean__photo img {
    border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
    transition: transform .5s var(--ease);
}
.dean__photo:hover img { transform: translateY(-6px) rotate(-1.2deg); }
.dean__photo::before {
    content: ''; position: absolute; inset: 20px -20px -20px 20px; z-index: -1;
    border-radius: var(--radius-xl);
    background: var(--grad-brand); background-size: 200% 100%;
    opacity: .85;
    animation: ahs-pan 10s ease-in-out infinite;
}
.dean__quote {
    position: relative; padding-left: 34px;
    font-size: 1.04rem; color: var(--ink-soft); line-height: 1.9;
}
.dean__quote::before {
    content: '"'; position: absolute; left: 0; top: -22px;
    font-size: 4.4rem; line-height: 1;
    background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent;
    font-family: Georgia, serif;
}
.dean__name { margin: 24px 0 2px; font-size: 1.16rem; font-weight: 700; color: var(--plum); }
.dean__role { margin: 0; font-size: .93rem; color: var(--pink-700); font-weight: 500; }

/* ==========================================================================
   สถิติ
   ========================================================================== */

.stats {
    position: relative; overflow: hidden;
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px;
    padding: 44px 34px; border-radius: var(--radius-xl);
    background: var(--grad-dark); background-size: 200% 100%;
    animation: ahs-pan 18s ease-in-out infinite;
    color: #fff; box-shadow: var(--shadow-lg);
}
.stats::before {
    content: ''; position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, .14) 1px, transparent 1px);
    background-size: 26px 26px; opacity: .5;
}
.stat { position: relative; text-align: center; padding: 8px 6px; border-radius: var(--radius); transition: background .3s var(--ease); }
.stat:hover { background: rgba(255, 255, 255, .08); }
.stat + .stat::before {
    content: ''; position: absolute; left: -10px; top: 18%; bottom: 18%;
    width: 1px; background: rgba(255, 255, 255, .18);
}
.stat__num {
    font-size: clamp(2rem, 1.4rem + 2vw, 2.9rem); font-weight: 800; line-height: 1.1;
    letter-spacing: -1px;
    background: linear-gradient(120deg, #fff 25%, #ffdcea 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat__label { font-size: .92rem; opacity: .88; }

/* ==========================================================================
   แถบหัวหน้าใน (page hero)
   ========================================================================== */

.pagehero {
    position: relative; padding: 76px 0 66px; color: #fff;
    background: var(--grad-dark); background-size: 200% 100%;
    animation: ahs-pan 16s ease-in-out infinite;
    overflow: hidden;
}
.pagehero::before {
    content: ''; position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, .15) 1px, transparent 1px);
    background-size: 24px 24px; opacity: .45;
    mask-image: linear-gradient(120deg, transparent 30%, #000 100%);
    -webkit-mask-image: linear-gradient(120deg, transparent 30%, #000 100%);
}
.pagehero::after {
    content: ''; position: absolute; right: -90px; top: -110px;
    width: 380px; height: 380px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, .18), transparent 68%);
    animation: ahs-blob 20s ease-in-out infinite;
}
.pagehero .container { position: relative; z-index: 2; }
.pagehero__title {
    margin: 0; color: #fff;
    font-size: clamp(1.7rem, 1.2rem + 2.2vw, 2.6rem);
    letter-spacing: -.8px;
    animation: ahs-rise .8s var(--ease) both;
}
.pagehero__desc {
    margin: 12px 0 0; max-width: 62ch; color: rgba(255, 255, 255, .88);
    animation: ahs-rise .8s var(--ease) .12s both;
}
/* บางหน้ามีข้อความบรรยายยาวกว่าปกติ แต่ยังสั้นพอจะอยู่บรรทัดเดียวได้ในจอกว้าง จึงขยาย max-width ให้เฉพาะจุดนั้น */
.pagehero__desc--wide { max-width: 96ch; }

.breadcrumb {
    display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
    margin-bottom: 16px; font-size: .87rem; color: rgba(255, 255, 255, .72);
    animation: ahs-rise .7s var(--ease) both;
}
/* WCAG 2.2 — พื้นที่กดของลิงก์ต้องสูงอย่างน้อย 24px จึงกำหนด min-height ไว้ให้ชัด */
.breadcrumb a {
    display: inline-flex; align-items: center; min-height: 24px;
    color: rgba(255, 255, 255, .84);
}
.breadcrumb a:hover { color: #fff; }
.breadcrumb svg { width: 13px; height: 13px; opacity: .6; }

/* ==========================================================================
   ภาพแนะนำหลักสูตร
   ========================================================================== */

.program-hero {
    width: 100%; height: 360px; object-fit: cover;
    border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
}

/* ==========================================================================
   โครง 2 คอลัมน์ / กล่องเนื้อหา
   ========================================================================== */

.layout { display: grid; grid-template-columns: 1fr 300px; gap: 46px; align-items: start; }
.layout--reverse { grid-template-columns: 300px 1fr; }
/* กันเนื้อหากว้าง (เช่น .orgchart, ตารางกว้าง) ดันคอลัมน์ grid ให้บวมเกินความกว้างที่ตั้งไว้ —
   ค่าเริ่มต้นของ grid item คือ min-width:auto ซึ่งจะขยายตามเนื้อหาข้างในแทนที่จะ scroll ในตัวเอง */
.layout > * { min-width: 0; }

.panel {
    position: relative;
    padding: 34px 36px; background: #fff;
    border: 1px solid var(--line); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow .35s var(--ease), transform .35s var(--ease);
}
.panel:hover { box-shadow: var(--shadow); }
.panel + .panel { margin-top: 26px; }
.panel__title {
    display: flex; align-items: center; gap: 12px;
    margin: 0 0 22px; padding-bottom: 16px;
    border-bottom: 2px solid var(--pink-100); font-size: 1.24rem;
}
.panel__title svg {
    width: 34px; height: 34px; flex: none; padding: 6px;
    color: #fff; background: var(--pink-600); border-radius: 11px;
    box-shadow: 0 6px 16px rgba(224, 77, 140, .3);
}

.sticky { position: sticky; top: calc(var(--header-h) + 22px); }

.sidebox {
    padding: 24px 26px;
    background: var(--pink-50);
    border: 1px solid var(--pink-100); border-radius: var(--radius-lg);
}
.sidebox + .sidebox { margin-top: 20px; }
.sidebox__title { margin: 0 0 14px; font-size: 1.05rem; }
.sidebox__title svg { width: 18px; height: 18px; vertical-align: -3px; margin-right: 6px; color: var(--pink-700); }
/* ลิสต์ตัวเลขในกล่องข้างแคบกว่าเนื้อหาหลัก จึงย่อหมายเลขลงเล็กน้อยไม่ให้เบียดข้อความ */
.sidebox .numlist li { padding-left: 42px; margin-bottom: 13px; }
.sidebox .numlist li::before { width: 28px; height: 28px; border-radius: 10px; font-size: .82rem; }
.sidenav { list-style: none; margin: 0; padding: 0; }
.sidenav li { margin: 0; }
.sidenav a {
    display: flex; align-items: center; gap: 10px; padding: 11px 14px;
    border-radius: var(--radius-sm); font-size: .93rem; color: var(--ink);
    transition: background .22s var(--ease), color .22s var(--ease), transform .25s var(--ease);
}
.sidenav a:hover { background: #fff; color: var(--pink-700); transform: translateX(5px); box-shadow: var(--shadow-sm); }
.sidenav a.is-active {
    background: var(--pink-600); color: #fff; font-weight: 600;
    box-shadow: 0 8px 20px rgba(224, 77, 140, .3);
}
.sidenav svg { width: 16px; height: 16px; flex: none; opacity: .7; }

/* ==========================================================================
   ลิสต์แบบมีไอคอน
   ========================================================================== */

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
    position: relative; padding-left: 38px; margin-bottom: 14px; line-height: 1.78;
}
.checklist li::before {
    content: ''; position: absolute; left: 0; top: 7px;
    width: 24px; height: 24px; border-radius: 50%;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E"),
        linear-gradient(0deg, #e04d8c, #e04d8c);
    background-size: 13px, cover;
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
    box-shadow: 0 4px 12px rgba(224, 77, 140, .28);
}

.numlist { list-style: none; margin: 0; padding: 0; counter-reset: n; }
.numlist li {
    position: relative; padding-left: 50px; margin-bottom: 18px; counter-increment: n; line-height: 1.78;
}
.numlist li::before {
    content: counter(n); position: absolute; left: 0; top: 2px;
    width: 34px; height: 34px; border-radius: 12px;
    background: var(--pink-600); color: #fff;
    display: grid; place-items: center; font-size: .9rem; font-weight: 700;
    box-shadow: 0 6px 16px rgba(224, 77, 140, .3);
}

/* ==========================================================================
   แผนผังองค์กร (Org Chart) — ทรี HTML แบบ ul/li ล้วน เชื่อมเส้นด้วย ::before/::after
   ========================================================================== */

/* ไม่ใช้ scrollbar — ถ้าแผนผังกว้างเกินพื้นที่ จะถูกย่อสัดส่วนให้พอดี 100% ด้วย JS (ดู fitOrgCharts ใน main.js) */
.orgchart { overflow: hidden; padding: 6px 4px 18px; }
.orgchart > ul { transform-origin: top left; }
.orgchart ul {
    display: flex; justify-content: safe center;
    list-style: none; margin: 0; padding-top: 32px;
    position: relative;
}
/* เส้นดิ่งจากกล่องพ่อแม่ลงมาหาแถวลูก */
.orgchart ul ul::before {
    content: ''; position: absolute; top: 0; left: 50%;
    width: 0; height: 32px;
    border-left: 2px solid var(--pink-200);
}
.orgchart li {
    display: flex; flex-direction: column; align-items: center;
    list-style: none; position: relative; padding: 32px 14px 0;
}
/* เส้นแนวนอนครึ่งซ้าย/ขวาของแต่ละกล่อง ต่อกันเป็นเส้นเดียวตลอดแถว */
.orgchart li::before,
.orgchart li::after {
    content: ''; position: absolute; top: 0; width: 50%; height: 32px;
    border-top: 2px solid var(--pink-200);
}
.orgchart li::before { right: 50%; }
.orgchart li::after  { left: 50%; border-left: 2px solid var(--pink-200); }
.orgchart li:first-child::before { border-top: 0 none; }
.orgchart li:last-child::after  { border-top: 0 none; }
/* กล่องเดี่ยว (ไม่มีพี่น้อง) เอาไว้แค่เส้นดิ่งตรงกลาง ไม่ต้องมีเส้นแยกซ้าย-ขวา */
.orgchart li:only-child { padding-top: 0; }
.orgchart li:only-child::before,
.orgchart li:only-child::after { display: none; }

.orgchart__box {
    display: inline-block; min-width: 168px; max-width: 210px;
    padding: 13px 16px; border-radius: var(--radius-sm);
    background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-sm);
    font-size: .87rem; font-weight: 500; color: var(--ink); line-height: 1.5;
    transition: transform .25s var(--ease-spring), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.orgchart__box--root {
    min-width: 200px; max-width: none;
    background: var(--grad-brand); color: #fff; border-color: transparent;
    font-size: .98rem; font-weight: 700; box-shadow: var(--shadow-pink);
}
.orgchart__box--branch { background: var(--pink-50); border-color: var(--pink-200); font-weight: 600; color: var(--pink-800); }
.orgchart__box--sm { min-width: 128px; font-size: .82rem; padding: 10px 12px; }
a.orgchart__box:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--pink-300); color: var(--pink-700); }

@media (max-width: 720px) {
    .orgchart__box { min-width: 136px; font-size: .82rem; padding: 11px 12px; }
    .orgchart__box--sm { min-width: 112px; font-size: .78rem; }
}

/* จอแคบ: เรียงกล่องเป็นแนวตั้งแทนการย่อสัดส่วนทั้งหมด — ย่อจนตัวอักษรอ่านไม่ออกไม่คุ้มกับการไม่มี scrollbar */
@media (max-width: 720px) {
    .orgchart ul { flex-direction: column; align-items: center; padding-top: 0; }
    .orgchart li { padding: 20px 0 0; }
    .orgchart li::before,
    .orgchart li::after { display: none; }
    .orgchart ul ul::before { height: 20px; }
}

/* ==========================================================================
   บุคลากร
   ========================================================================== */

.person {
    position: relative; overflow: hidden;
    text-align: center; padding: 28px 18px 28px;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform .38s var(--ease-spring), box-shadow .38s var(--ease), border-color .3s var(--ease);
}
.person::before {
    content: ''; position: absolute; inset: 0 0 auto 0; height: 4px;
    background: var(--pink-600);
    transform: scaleX(0); transform-origin: 0 50%;
    transition: transform .4s var(--ease);
}
.person:hover { transform: translateY(-8px); box-shadow: var(--shadow-lg); border-color: var(--pink-200); }
.person:hover::before { transform: scaleX(1); }
.person__photo {
    position: relative;
    width: 126px; height: 126px; margin: 0 auto 18px;
    border-radius: 50%; overflow: hidden;
    border: 4px solid transparent;
    background: var(--pink-600) border-box;
    box-shadow: 0 8px 22px rgba(224, 77, 140, .22);
    transition: transform .45s var(--ease-spring);
}
.person:hover .person__photo { transform: scale(1.06); }
/* รูปบุคคลจริงเป็นแนวตั้ง 3:4 ใบหน้าอยู่ส่วนบน — เลื่อนจุดครอปขึ้นให้วงกลมจับที่ใบหน้า ไม่ใช่กลางลำตัว */
.person__photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; border-radius: 50%; }
.person__name { margin: 0 0 5px; font-size: 1.02rem; line-height: 1.45; }
.person__role { margin: 0; font-size: .88rem; color: var(--pink-700); font-weight: 500; }
.person__extra { margin: 7px 0 0; font-size: .84rem; color: var(--ink-faint); }

.person--lead { border-color: var(--pink-200); box-shadow: var(--shadow); }
.person--lead .person__photo { width: 156px; height: 156px; }

/* ==========================================================================
   ตาราง
   ========================================================================== */

.table-wrap {
    overflow-x: auto; border: 1px solid var(--line);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); background: #fff;
}
table { width: 100%; border-collapse: collapse; font-size: .95rem; min-width: 480px; }
thead th {
    padding: 15px 16px; text-align: left;
    background: var(--pink-600); color: #fff;
    font-weight: 600; white-space: nowrap;
}
tbody td { padding: 13px 16px; border-top: 1px solid var(--line); vertical-align: top; }
tbody tr { transition: background .22s var(--ease); }
tbody tr:nth-child(even) { background: var(--surface-alt); }
tbody tr:hover { background: var(--pink-50); }

/* ==========================================================================
   แผนการเรียน
   ========================================================================== */

.plan { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.plan__year {
    position: relative; overflow: hidden;
    padding: 22px 24px; background: var(--surface-alt);
    border: 1px solid var(--line); border-radius: var(--radius);
    transition: transform .35s var(--ease), box-shadow .35s var(--ease), background .3s var(--ease);
}
.plan__year::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
    background: var(--pink-600);
}
.plan__year:hover { transform: translateY(-5px); background: #fff; box-shadow: var(--shadow); }
/* หัวข้อในการ์ดเป็น h3 (อยู่ใต้ h2 ของส่วนนั้น) — กำหนดขนาดไว้เท่าเดิมกับตอนที่ยังเป็น h4 */
.plan__year h3 { margin: 0 0 12px; font-size: 1.05rem; color: var(--pink-800); }
.plan__year ul { margin: 0; padding-left: 1.2em; }
.plan__year li { font-size: .93rem; color: var(--ink-soft); margin-bottom: .35em; }

/* ==========================================================================
   กล่องดาวน์โหลด
   ========================================================================== */

.download {
    display: flex; align-items: center; gap: 18px; padding: 22px 24px;
    background: var(--pink-50);
    border: 1px dashed var(--pink-300); border-radius: var(--radius);
    transition: background .3s var(--ease), border-color .3s var(--ease), transform .35s var(--ease);
}
.download:hover { border-color: var(--pink-600); transform: translateY(-4px); box-shadow: var(--shadow); }
.download__icon {
    width: 54px; height: 54px; flex: none; display: grid; place-items: center;
    background: var(--pink-600); color: #fff; border-radius: 16px;
    box-shadow: 0 8px 20px rgba(224, 77, 140, .3);
    transition: transform .4s var(--ease-spring);
}
.download:hover .download__icon { transform: translateY(-3px) rotate(-6deg); }
.download__icon svg { width: 25px; height: 25px; }
.download__name { font-weight: 600; color: var(--plum); }
.download__meta { font-size: .85rem; color: var(--ink-faint); }

/* ==========================================================================
   เนื้อหาจากโปรแกรมแก้ไขข้อความในหลังบ้าน (เนื้อข่าว)
   HTML ผ่าน HTML Purifier ตอนบันทึกแล้ว ที่นี่ดูแลแค่ให้อ่านง่ายและไม่ล้นกรอบ
   ========================================================================== */

.richtext { line-height: 1.8; }
.richtext > :first-child { margin-top: 0; }
.richtext > :last-child { margin-bottom: 0; }
.richtext p { margin: 0 0 16px; }
.richtext h2 { font-size: 1.25rem; margin: 28px 0 10px; }
.richtext h3 { font-size: 1.1rem;  margin: 24px 0 8px; }
.richtext h4 { font-size: 1rem;    margin: 20px 0 6px; }
.richtext ul, .richtext ol { margin: 0 0 16px; padding-left: 26px; }
.richtext li { margin-bottom: 6px; }
.richtext a { color: var(--pink-700); text-decoration: underline; text-underline-offset: 3px; }
.richtext blockquote {
    margin: 0 0 16px; padding: 12px 20px;
    border-left: 3px solid var(--pink-300); background: var(--pink-50); color: var(--ink-soft);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.richtext hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
/* รูปที่แทรกในเนื้อหาต้องไม่ดันหน้าให้ล้น ไม่ว่าจะอัปโหลดมาขนาดไหน */
.richtext img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
/* ตารางกว้างให้เลื่อนในกรอบของตัวเอง ไม่ใช่ดันทั้งหน้า */
.richtext table { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: .93rem; display: block; overflow-x: auto; }
.richtext th, .richtext td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
.richtext th { background: var(--pink-50); font-weight: 600; }

/* ==========================================================================
   ติดต่อ
   ========================================================================== */

.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li { display: flex; gap: 15px; margin-bottom: 18px; align-items: flex-start; }
.contact-list svg {
    width: 34px; height: 34px; flex: none; padding: 7px; margin-top: 2px;
    color: #fff; background: var(--pink-600); border-radius: 11px;
    box-shadow: 0 6px 16px rgba(224, 77, 140, .26);
}
.contact-list b { display: block; font-weight: 600; color: var(--plum); }
.contact-list span { font-size: .93rem; color: var(--ink-soft); }

.map-frame {
    border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
    box-shadow: var(--shadow); line-height: 0;
}
.map-frame iframe { width: 100%; height: 400px; border: 0; filter: saturate(1.05); }

/* ==========================================================================
   แบบฟอร์ม (หน้าส่งข้อร้องเรียน)
   ========================================================================== */

.form__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px 22px; }

.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field--full { grid-column: 1 / -1; }
.field > label { font-size: .92rem; font-weight: 600; color: var(--plum); }
.req { color: var(--pink-700); }

.field input,
.field select,
.field textarea {
    width: 100%; padding: 12px 15px;
    font: inherit; font-size: .95rem; color: var(--ink);
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
    transition: border-color .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease);
}
.field textarea { min-height: 176px; resize: vertical; line-height: 1.78; }
.field input::placeholder,
.field textarea::placeholder { color: var(--ink-faint); }
.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--pink-200); }
.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none; border-color: var(--pink);
    box-shadow: 0 0 0 4px rgba(237, 116, 164, .18);
}

/* ลูกศรของ select วาดเองเพื่อให้หน้าตาตรงกับช่องกรอกอื่น ๆ ทุกเบราว์เซอร์ */
.field select {
    appearance: none; -webkit-appearance: none; padding-right: 44px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238c8390' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 15px center; background-size: 17px;
}

.field__hint { font-size: .82rem; color: var(--ink-faint); }
.field__error { font-size: .84rem; font-weight: 500; color: #c02440; }
.field.has-error > label { color: #c02440; }
.field.has-error input,
.field.has-error select,
.field.has-error textarea { border-color: #e88ea0; background: #fffafb; }
.field.has-error input:focus,
.field.has-error select:focus,
.field.has-error textarea:focus { border-color: #d92d4b; box-shadow: 0 0 0 4px rgba(217, 45, 75, .15); }

/* ปิดใช้งานเมื่อเลือก "ไม่ประสงค์ออกนาม" */
.field input:disabled { background: var(--surface-alt); color: var(--ink-faint); cursor: not-allowed; }
.field.is-disabled > label { color: var(--ink-faint); }

/* ช่องติ๊กยินยอม/ไม่ประสงค์ออกนาม — กดได้ทั้งกล่องเพราะห่อด้วย label */
.form__check {
    display: flex; align-items: flex-start; gap: 12px; cursor: pointer;
    padding: 15px 18px; background: var(--pink-50);
    border: 1px solid var(--pink-100); border-radius: var(--radius-sm);
    transition: background .25s var(--ease), border-color .25s var(--ease);
}
.form__check:hover { background: #fff; border-color: var(--pink-200); }
.form__check input { width: 19px; height: 19px; flex: none; margin-top: 2px; accent-color: var(--pink-600); cursor: pointer; }
.form__check > span { font-size: .9rem; font-weight: 400; color: var(--ink-soft); line-height: 1.72; }
.field.has-error .form__check { border-color: #e88ea0; background: #fffafb; }

.form__actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 26px; }

/* ช่องล่อบอท — ต้องซ่อนจากสายตาแต่ยังอยู่ในหน้าเพื่อให้บอทเห็น จึงไม่ใช้ display:none */
.form__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- กล่องแจ้งเตือน ---- */
.alert {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 17px 20px; margin-bottom: 24px;
    border-radius: var(--radius); font-size: .93rem; line-height: 1.7;
}
.alert svg { width: 24px; height: 24px; flex: none; margin-top: 2px; }
.alert ul { margin: 8px 0 0; padding-left: 1.15em; }
.alert li { margin-bottom: 4px; }
.alert--error { background: #fdeef1; border: 1px solid #f6c9d2; color: #8f1f38; }
.alert--ok { background: #eefaf3; border: 1px solid #bfe8d1; color: #1c6b41; }

/* ---- หน้าผลลัพธ์หลังส่งเรื่องสำเร็จ ---- */
.result { text-align: center; padding: 14px 0 4px; }
.result__icon {
    width: 78px; height: 78px; margin: 0 auto 20px;
    display: grid; place-items: center; border-radius: 50%;
    background: var(--grad-brand); color: #fff; box-shadow: var(--shadow-pink);
}
.result__icon svg { width: 38px; height: 38px; stroke-width: 2.6; }
.result__ref {
    display: inline-block; margin: 4px 0 20px; padding: 12px 28px;
    font-size: 1.3rem; font-weight: 700; letter-spacing: .06em;
    color: var(--pink-800); background: var(--pink-50);
    border: 1px dashed var(--pink-300); border-radius: var(--radius-sm);
}

/* ==========================================================================
   CTA
   ========================================================================== */

.cta {
    position: relative; overflow: hidden;
    padding: 62px 46px; border-radius: var(--radius-xl); text-align: center; color: #fff;
    background: var(--grad-cta); background-size: 220% 100%;
    animation: ahs-pan 12s ease-in-out infinite;
    box-shadow: var(--shadow-lg);
}
.cta::before {
    content: ''; position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, .18) 1px, transparent 1px);
    background-size: 24px 24px; opacity: .5;
}
.cta::after {
    content: ''; position: absolute; left: -160px; bottom: -180px;
    width: 420px; height: 420px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, .2), transparent 70%);
    animation: ahs-blob 18s ease-in-out infinite;
}
.cta > * { position: relative; z-index: 1; }
.cta h2 { color: #fff; margin-bottom: 14px; text-shadow: 0 3px 18px rgba(0, 0, 0, .16); }
.cta p { max-width: 58ch; margin-inline: auto; color: rgba(255, 255, 255, .92); }
.cta__actions { display: flex; gap: 13px; justify-content: center; flex-wrap: wrap; margin-top: 28px; }

/* ==========================================================================
   ส่วนท้าย
   ========================================================================== */

.footer {
    position: relative; overflow: hidden;
    background: #35172a; color: rgba(255, 255, 255, .74);
    padding: 66px 0 0; font-size: .93rem;
}
.footer::before {
    content: ''; position: absolute; left: -120px; top: -140px;
    width: 460px; height: 460px; border-radius: 50%;
    background: radial-gradient(circle, rgba(237, 116, 164, .3), transparent 68%);
    filter: blur(30px);
    animation: ahs-blob 24s ease-in-out infinite;
}
.footer::after {
    content: ''; position: absolute; right: -140px; bottom: -100px;
    width: 420px; height: 420px; border-radius: 50%;
    background: radial-gradient(circle, rgba(201, 59, 118, .3), transparent 68%);
    filter: blur(30px);
    animation: ahs-blob 28s ease-in-out infinite reverse;
}
.footer .container { position: relative; z-index: 1; }
.footer h2 { color: #fff; font-size: 1.05rem; margin-bottom: 18px; }
.footer a { color: rgba(255, 255, 255, .74); }
.footer a:hover { color: var(--pink-300); }
.footer__grid { display: grid; grid-template-columns: 1.3fr 2fr 1.1fr; gap: 40px; padding-bottom: 46px; }
/* รายชื่อหน่วยงานมีจำนวนมาก (20+ รายการ) จึงไหลเป็น 2 คอลัมน์ย่อยแทนลิสต์ยาวคอลัมน์เดียว */
.footer__units { column-count: 2; column-gap: 28px; }
.footer__units li { break-inside: avoid; }
/* เดิมพื้นที่กดสูง 21px — เพิ่มระยะบน/ล่างให้ครบ 24px ตาม WCAG 2.2 */
.footer__units li a,
.footer__units li span {
    display: inline-block; padding-block: 2px;
    font-size: .88rem; line-height: 1.5;
}
.footer__units-sub { padding-left: 16px; opacity: .82; }
.footer__units-sub a,
.footer__units-sub span { font-size: .84rem; }
.footer__brand { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.footer__brand .brand__name { color: #fff; }
.footer__brand .brand__sub { color: rgba(255, 255, 255, .6); }
/* โลโก้มีตัวอักษรสีเข้ม จึงวางบนพื้นขาวเพื่อให้อ่านออกบนพื้นหลังสีเข้มของส่วนท้าย */
.footer__brand .brand__logo {
    height: 72px; background: #fff; padding: 8px 11px; border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer ul li { margin-bottom: 10px; }
.footer ul li a { display: inline-block; transition: transform .25s var(--ease), color .25s var(--ease); }
.footer ul li a:hover { transform: translateX(5px); }
.footer__contact li { display: flex; gap: 11px; align-items: flex-start; }
.footer__contact svg { width: 17px; height: 17px; flex: none; margin-top: 5px; color: var(--pink-300); }
/* ปุ่มลัดในส่วนท้าย (ส่งข้อร้องเรียน) — ระบุ .footer นำหน้าเพื่อให้ชนะสีลิงก์รวมของส่วนท้าย */
.footer .footer__cta {
    display: inline-flex; align-items: center; gap: 9px; margin-top: 18px;
    padding: 11px 20px; border-radius: 999px;
    font-size: .9rem; font-weight: 500; color: #fff;
    background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .2);
    transition: background .28s var(--ease), border-color .28s var(--ease), transform .3s var(--ease), box-shadow .3s var(--ease);
}
.footer .footer__cta:hover {
    background: var(--pink-600); border-color: var(--pink-600); color: #fff;
    transform: translateY(-3px); box-shadow: 0 12px 28px rgba(224, 77, 140, .4);
}
.footer .footer__cta svg { width: 17px; height: 17px; flex: none; }

.footer__social { display: flex; gap: 10px; margin-top: 18px; }
.footer__social a {
    width: 42px; height: 42px; display: grid; place-items: center;
    background: rgba(255, 255, 255, .1); border-radius: 14px; color: #fff;
    transition: background .3s var(--ease), transform .38s var(--ease-spring), box-shadow .3s var(--ease);
}
.footer__social a:hover {
    background: var(--pink-600); transform: translateY(-5px) rotate(-6deg); color: #fff;
    box-shadow: 0 10px 24px rgba(224, 77, 140, .4);
}
.footer__social svg { width: 19px; height: 19px; }
.footer__bottom {
    position: relative; z-index: 1;
    padding: 20px 0; border-top: 1px solid rgba(255, 255, 255, .12);
    font-size: .87rem; text-align: center; color: rgba(255, 255, 255, .55);
}

/* ==========================================================================
   ปุ่มกลับขึ้นบน
   ========================================================================== */

.totop {
    position: fixed; right: 22px; bottom: 22px; z-index: 90;
    width: 50px; height: 50px; display: grid; place-items: center;
    background: var(--pink-600); color: #fff; border: 0; border-radius: 50%;
    box-shadow: var(--shadow-pink); cursor: pointer;
    opacity: 0; visibility: hidden; transform: translateY(16px) scale(.85);
    transition: opacity .35s var(--ease), transform .45s var(--ease-spring), visibility .35s;
}
.totop.is-visible { opacity: 1; visibility: visible; transform: none; }
.totop:hover { transform: translateY(-4px) scale(1.08); }
.totop svg { width: 21px; height: 21px; }

/* ==========================================================================
   Lightbox
   ========================================================================== */

.lightbox {
    position: fixed; inset: 0; z-index: 200; display: none;
    place-items: center; padding: 30px;
    background: rgba(30, 12, 22, .9);
    backdrop-filter: blur(10px);
}
.lightbox.is-open { display: grid; animation: lightbox-in .3s var(--ease); }
@keyframes lightbox-in { from { opacity: 0; } to { opacity: 1; } }
.lightbox img {
    max-width: min(1100px, 92vw); max-height: 82vh;
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    animation: ahs-pop .45s var(--ease-spring);
}
.lightbox__caption { margin-top: 16px; text-align: center; color: rgba(255, 255, 255, .85); font-size: .95rem; }
.lightbox__close {
    position: absolute; top: 20px; right: 24px;
    width: 46px; height: 46px; display: grid; place-items: center;
    background: rgba(255, 255, 255, .14); border: 0; border-radius: 50%;
    color: #fff; cursor: pointer; font-size: 1.5rem; line-height: 1;
    transition: background .25s var(--ease), transform .35s var(--ease-spring);
}
.lightbox__close:hover { background: var(--pink-600); transform: rotate(90deg); }
.lightbox__nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 50px; height: 50px; display: grid; place-items: center;
    background: rgba(255, 255, 255, .14); border: 0; border-radius: 50%;
    color: #fff; cursor: pointer;
    transition: background .25s var(--ease), transform .35s var(--ease-spring);
}
.lightbox__nav:hover { background: rgba(255, 255, 255, .3); }
.lightbox__nav--prev { left: 24px; }
.lightbox__nav--prev:hover { transform: translateY(-50%) translateX(-5px) scale(1.08); }
.lightbox__nav--next { right: 24px; }
.lightbox__nav--next:hover { transform: translateY(-50%) translateX(5px) scale(1.08); }
.lightbox__nav svg { width: 24px; height: 24px; }

/* ==========================================================================
   ตัวกรอง
   ========================================================================== */

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 32px; }
.filter {
    position: relative; isolation: isolate;
    padding: 9px 20px; border: 1px solid var(--line); border-radius: 999px;
    background: #fff; font: inherit; font-size: .9rem; font-weight: 500; color: var(--ink-soft);
    cursor: pointer;
    transition: color .25s var(--ease), border-color .25s var(--ease),
                transform .3s var(--ease-spring), box-shadow .3s var(--ease);
}
.filter::before {
    content: ''; position: absolute; inset: 0; z-index: -1; border-radius: 999px;
    background: var(--pink-600); opacity: 0; transform: scale(.75);
    transition: opacity .28s var(--ease), transform .35s var(--ease-spring);
}
.filter:hover { border-color: var(--pink-300); color: var(--pink-700); transform: translateY(-2px); }
.filter.is-active { color: #fff; border-color: transparent; box-shadow: var(--shadow-pink); }
.filter.is-active::before { opacity: 1; transform: scale(1); }

.empty { padding: 52px 20px; text-align: center; color: var(--ink-faint); }

/* ==========================================================================
   แอนิเมชันตอนเลื่อน
   ========================================================================== */

/* ซ่อนไว้เฉพาะเมื่อ JavaScript ทำงาน — ถ้า JS ล้มเหลว เนื้อหาจะยังแสดงตามปกติ */
.js .reveal {
    opacity: 0;
    transform: translate3d(0, 34px, 0);
    transition: opacity .75s var(--ease), transform .85s var(--ease), filter .75s var(--ease);
    filter: blur(6px);
    will-change: opacity, transform;
}
.js .reveal.is-shown { opacity: 1; transform: none; filter: none; }

/* ทิศทางอื่น ๆ เลือกใช้ด้วย data-reveal */
.js [data-reveal="left"]  { transform: translate3d(-44px, 0, 0); }
.js [data-reveal="right"] { transform: translate3d(44px, 0, 0); }
.js [data-reveal="zoom"]  { transform: scale(.9); }
.js [data-reveal="flip"]  { transform: perspective(900px) rotateX(14deg) translate3d(0, 28px, 0); }

/* เอฟเฟกต์เอียงตามเมาส์ (ควบคุมด้วย JS) */
[data-tilt] { transform-style: preserve-3d; will-change: transform; }

/* ค่อย ๆ ปรากฏตอนเปิดหน้า */
.js body { animation: page-in .5s var(--ease) both; }
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
    .grid--4 { grid-template-columns: repeat(2, 1fr); }
    .grid--3 { grid-template-columns: repeat(2, 1fr); }
    .layout, .layout--reverse { grid-template-columns: 1fr; gap: 32px; }
    .sticky { position: static; }
    /* เหลือ 3 ส่วนไม่เท่ากันแล้ว (แบรนด์/หน่วยงาน/ติดต่อ) เรียง 2 คอลัมน์แล้วเหลือรายการเดียวลอยไม่สมดุล จึงวางเรียงเต็มความกว้างแทน */
    .footer__grid { grid-template-columns: 1fr; gap: 32px; }
    .footer__units { column-count: 3; }
    .dean { grid-template-columns: 260px 1fr; gap: 36px; }
    .quicklinks__grid { grid-template-columns: repeat(2, 1fr); }
}

/* เมนูหลักมี 6 หัวข้อและปุ่มสมัครเรียน กว้างรวมราว 770px
   จึงเรียงแนวนอนได้เฉพาะเมื่อ container เต็มความกว้าง (จอ 1181px ขึ้นไป)
   ต่ำกว่านั้นยุบเป็นเมนูแบบกดเปิด */
@media (max-width: 1180px) {
    .nav-toggle { display: grid; }
    /* แผงเมนูเป็นแถวที่สองของส่วนหัวเลย (ไม่ลอยทับ) จึงไม่มีช่องว่างคั่นไม่ว่าส่วนหัวจะสูงเท่าใด */
    .header .container { flex-wrap: wrap; }
    .nav {
        width: 100%; margin-bottom: 6px;
        max-height: 70vh; overflow-y: auto;
        border-top: 1px solid var(--line);
        padding: 6px 0 14px;
        display: none;
    }
    .nav.is-open { display: block; animation: nav-in .35s var(--ease); }
    @keyframes nav-in { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
    .nav__list { flex-direction: column; align-items: stretch; gap: 0; }
    .nav__item { border-bottom: 1px solid var(--line); }
    .nav__item:last-child { border-bottom: 0; }
    .nav__link { padding: 15px 12px; justify-content: space-between; border-radius: var(--radius-sm); }
    .nav__link:hover, .nav__item:hover > .nav__link { transform: none; }
    .nav__sub {
        position: static; opacity: 1; visibility: visible; transform: none;
        background: transparent; backdrop-filter: none;
        box-shadow: none; border: 0; border-radius: 0; padding: 0 0 8px 12px;
        display: none; min-width: 0; overflow: visible;
    }
    /* ไม่มีแผงลอยให้ขีดคั่นแล้ว จึงซ่อนเส้นไล่สีขอบบนที่ออกแบบไว้สำหรับดรอปดาวน์บนจอกว้าง */
    .nav__sub::after { display: none; }
    .nav__sub a { padding: 9px 12px 9px 18px; font-size: .9rem; }
    .nav__item.is-open > .nav__sub { display: block; }
    .nav__item:hover > .nav__link svg { transform: none; }
    .nav__item.is-open > .nav__link svg { transform: rotate(180deg); }
    .nav__item--cta { margin: 14px 0 0; border-bottom: 0; }
    .nav__item--cta .btn { width: 100%; }
    .topbar__info span:not(:first-child) { display: none; }
}

@media (max-width: 720px) {
    body { font-size: 16px; }
    .section { padding: 62px 0; }
    .grid--3, .grid--4, .grid--2 { grid-template-columns: 1fr; }
    .dean { grid-template-columns: 1fr; gap: 30px; }
    .dean__photo { max-width: 270px; margin-inline: auto; }
    .dean__photo::before { display: none; }
    .stats { grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 28px 18px; }
    .stat + .stat::before { display: none; }
    .plan { grid-template-columns: 1fr; }
    .form__grid { grid-template-columns: 1fr; gap: 18px; }
    .form__actions { gap: 12px; }
    .form__actions .btn { width: 100%; justify-content: center; }
    .result__ref { font-size: 1.1rem; padding: 11px 20px; letter-spacing: .04em; }
    .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 11px; }
    .nrow { grid-template-columns: 1fr; gap: 14px; }
    .nrow:hover { transform: none; }
    .footer__grid { grid-template-columns: 1fr; gap: 30px; }
    .footer__units { column-count: 1; }
    /* ชื่อมหาวิทยาลัยเต็มยาวเกินความกว้างจอ ทำให้แถบบนตัดเป็นสองบรรทัดและสูงเกือบ 90px
       บนจอเล็กจึงเหลือเฉพาะลิงก์เฟซบุ๊ก (ชื่อมหาวิทยาลัยยังอยู่ใต้โลโก้และในส่วนท้ายเว็บ) */
    .topbar__links a:first-child { display: none; }
    .panel { padding: 26px 22px; }
    .cta { padding: 44px 24px; }
    .hero__arrow { display: none; }
    .hero__scroll { display: none; }
    .program-hero { height: 220px; }
    /* เว้นที่ด้านล่างไว้ให้จุดบอกสไลด์ ไม่ให้ปุ่มทับกัน */
    .hero__track { height: 560px; }
    .hero__content { padding-bottom: 60px; }
    .hero__dots { bottom: 26px; }
    .quicklinks { margin-top: 22px; padding-bottom: 44px; }
    .quicklinks__grid { grid-template-columns: 1fr; gap: 12px; }
    .quicklinks__item { padding: 18px 20px; }
    /* ย่อขนาดตราสัญลักษณ์และชื่อคณะบนจอเล็ก แต่ยังคงแสดงชื่อมหาวิทยาลัยไว้ใต้ชื่อคณะ */
    .brand { gap: 10px; }
    .brand__logo, .header.is-stuck .brand__logo { height: 44px; }
    .brand__name { font-size: 1.1rem; }
    .brand__sub { font-size: .72rem; }
    .marquee__item { font-size: .92rem; }
}

/* ==========================================================================
   ลดการเคลื่อนไหว
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition-duration: .01ms !important;
        transition-delay: 0s !important;
        scroll-behavior: auto !important;
    }
    html { scroll-behavior: auto; }
    .js .reveal { opacity: 1; transform: none; filter: none; }
    .js .hero__slide .hero__eyebrow,
    .js .hero__slide .hero__title,
    .js .hero__slide .hero__text,
    .js .hero__slide .hero__actions { opacity: 1; transform: none; }
    .hero__dots button.is-active::after { transform: scaleX(1); }
}

/* ==========================================================================
   สำหรับพิมพ์
   ========================================================================== */

@media print {
    .topbar, .header, .hero, .quicklinks, .marquee, .footer,
    .totop, .filters, .progressbar { display: none !important; }
    body { font-size: 12pt; }
    .panel { border: 0; box-shadow: none; padding: 0; }
    .section--glow::before, .section--glow::after { display: none; }
}

/* ==========================================================================
   คลาสยูทิลิตี้ — ใช้แทน style="" ในหน้า PHP (CSP ไม่อนุญาตสไตล์ inline)
   ตั้งชื่อตามค่า: u-mt-26 = margin-top:26px · u-fs-105 = font-size:1.05rem
   ลำดับสำคัญ: u-m0 อยู่ก่อน u-mt-*/u-mb-* เพื่อให้ "margin:0 0 2px" เขียนเป็น u-m0 u-mb-2 ได้
   ========================================================================== */

.u-center  { text-align: center; }
.u-right   { text-align: right; }
.u-m0      { margin: 0; }
.u-mt-8    { margin-top: 8px; }
.u-mt-14   { margin-top: 14px; }
.u-mt-16   { margin-top: 16px; }
.u-mt-18   { margin-top: 18px; }
.u-mt-20   { margin-top: 20px; }
.u-mt-22   { margin-top: 22px; }
.u-mt-26   { margin-top: 26px; }
.u-mt-30   { margin-top: 30px; }
.u-mb-0    { margin-bottom: 0; }
.u-mb-2    { margin-bottom: 2px; }
.u-mb-12   { margin-bottom: 12px; }
.u-mb-18   { margin-bottom: 18px; }
.u-mb-22   { margin-bottom: 22px; }
.u-mb-24   { margin-bottom: 24px; }
.u-mb-28   { margin-bottom: 28px; }
.u-mx-auto { margin-inline: auto; }
.u-pt-24   { padding-top: 24px; }
.u-py-44   { padding-block: 44px; }
.u-gap-12  { gap: 12px; }
.u-gap-14  { gap: 14px; }
.u-gap-16  { gap: 16px; }
.u-fs-80   { font-size: .8rem; }
.u-fs-90   { font-size: .9rem; }
.u-fs-92   { font-size: .92rem; }
.u-fs-93   { font-size: .93rem; }
.u-fs-100  { font-size: 1rem; }
.u-fs-105  { font-size: 1.05rem; }
.u-fs-110  { font-size: 1.1rem; }
.u-fs-150  { font-size: 1.5rem; }
.u-bold    { font-weight: 600; }
.u-soft    { color: var(--ink-soft); }
.u-faint   { color: var(--ink-faint); }
.u-pink    { color: var(--pink-800); }
.u-rounded { border-radius: var(--radius); }
.u-w-full  { width: 100%; }
.u-w-100   { width: 100px; }
.u-w-110   { width: 110px; }
.u-w-180   { width: 180px; }
.u-w-190   { width: 190px; }
.u-w-210   { width: 210px; }
.u-w-280   { width: 280px; }
.u-w-34p   { width: 34%; }
.u-maxw-none  { max-width: none; }
.u-maxw-340   { max-width: 340px; }
.u-maxw-60ch  { max-width: 60ch; }
.u-minw-1080  { min-width: 1080px; }
.u-jc-center  { justify-content: center; }
.u-jc-end     { justify-content: flex-end; }
.u-ai-start   { align-items: flex-start; }
.u-lh-155     { line-height: 1.55; }

/* ชิ้นส่วนที่ซ้ำกันหลายหน้า — ตั้งชื่อตามความหมายแทนที่จะเรียงยูทิลิตี้ยาว ๆ */

/* ข้อความหมายเหตุใต้ตาราง/แผนการเรียน */
.note { margin: 20px 0 0; font-size: .9rem; color: var(--ink-faint); }

/* กลุ่มป้าย/ปุ่มเรียงแถว ตัดบรรทัดได้ */
.chips { display: flex; gap: 10px; flex-wrap: wrap; }

/* แถวไอคอน + ข้อความ (หน้าสำหรับนักศึกษา/บุคลากร) */
.iconrow { display: flex; align-items: center; gap: 14px; }
.iconrow__icon {
    flex: none; width: 44px; height: 44px; display: grid; place-items: center;
    background: var(--pink-600); color: #fff; border-radius: 12px;
}

/* การ์ดข่าวก่อนหน้า/ถัดไป (news-detail) — คอลัมน์เดียว ไม่มีรูป */
.nrow--single { grid-template-columns: 1fr; }

/* หน้าแนะนำคณะ */
.about__logo   { height: 160px; width: auto; margin-inline: auto; }
.about__name   { margin: 24px 0 4px; font-size: 1.4rem; }
.about__vision { font-size: 1.1rem; line-height: 1.85; color: var(--pink-800); font-weight: 500; margin: 0; }

/* รายการที่ถูกซ่อนด้วยตัวกรอง/สถานะ — เซิร์ฟเวอร์ใส่ attribute hidden แทน style="display:none" */
[hidden] { display: none !important; }
