:root {
  --primary: #1e3a8a;
  --primary-dark: color-mix(in srgb, var(--primary) 75%, #000);
  --primary-soft: color-mix(in srgb, var(--primary) 8%, #fff);
  --accent: #d71920;
  --on-dark: color-mix(in srgb, var(--accent) 30%, #fff);
  --text: #2b2b2b;
  --muted: #6c757d;
  --bg-alt: color-mix(in srgb, var(--primary) 5%, #fff);
  --accent-soft: color-mix(in srgb, var(--accent) 8%, #fff);
  /* แถบสีประจำวิทยาลัย น้ำเงิน-แดง */
  --college-stripe: linear-gradient(90deg, var(--primary) 0 65%, var(--accent) 65% 100%);
}

body {
  font-family: 'Kanit', sans-serif;
  font-weight: 300;
  color: var(--text);
  background: #fff;
}

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }
.page-link { color: var(--primary); }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

/* ---------- Ticker ---------- */
.ticker { background: var(--accent); color: #fff; font-size: .9rem; overflow: hidden; }
.ticker-label { background: var(--primary); color: #fff; padding: .3rem .8rem; white-space: nowrap; border-radius: 0 0 .4rem .4rem; flex-shrink: 0; }
.ticker-track { overflow: hidden; flex: 1; mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent); }
.ticker-move { display: inline-flex; white-space: nowrap; animation: ticker 40s linear infinite; }
.ticker:hover .ticker-move { animation-play-state: paused; }
.ticker-item { padding: .3rem 2.5rem .3rem 0; }
.ticker-item::before { content: '\25C6'; margin-right: .6rem; color: rgba(255,255,255,.7); font-size: .7em; }
.ticker-item a { color: inherit; text-decoration: none; }
.ticker-item a:hover { text-decoration: underline; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ticker-move { animation: none; } }

/* ---------- Top bar & header ---------- */
.topbar {
  background: var(--primary-dark);
  color: #fff;
  font-size: .85rem;
  padding: .35rem 0;
  border-bottom: 3px solid var(--accent);
}
.topbar a { color: #fff; text-decoration: none; }
.topbar a:hover { color: var(--on-dark); }
.font-size-ctl { display: inline-flex; border: 1px solid rgba(255,255,255,.35); border-radius: .3rem; overflow: hidden; }
.font-size-ctl button { background: none; border: 0; color: #fff; font-size: .78rem; padding: 0 .45rem; line-height: 1.6; }
.font-size-ctl button + button { border-left: 1px solid rgba(255,255,255,.35); }
.font-size-ctl button:hover { background: rgba(255,255,255,.15); }

.lang-switch { display: inline-flex; border-radius: .3rem; overflow: hidden; background: rgba(255,255,255,.12); }
.lang-switch a { padding: 0 .5rem; font-size: .78rem; line-height: 1.7; }
.lang-switch a.active { background: var(--accent); color: #fff; }

.btn-search { color: var(--primary); font-size: 1.25rem; border: 0; }
.btn-search:hover { background: var(--primary-soft); color: var(--primary); }
.btn-cta {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 75%, #000)); color: #fff !important;
  font-weight: 500; border-radius: 2rem; padding: .45rem 1rem; white-space: nowrap;
  box-shadow: 0 3px 10px color-mix(in srgb, var(--accent) 40%, transparent);
}
.btn-cta:hover { filter: brightness(1.06); }


.visit-stats li { display: flex; justify-content: space-between; padding: .35rem 0; border-bottom: 1px dashed rgba(255,255,255,.15); }
.visit-stats b { color: var(--on-dark); font-weight: 500; }

.site-header {
  background: #fff;
  border-bottom: 5px solid;
  border-image: var(--college-stripe) 1;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.site-header .navbar { padding: .5rem 0; }
.brand-logo { width: 56px; height: 56px; object-fit: contain; flex-shrink: 0; }
.brand-logo-text {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--accent), var(--primary) 70%);
  color: #fff; font-weight: 600; font-size: 1.3rem; letter-spacing: 1px;
  border: 3px solid var(--accent);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-th { font-weight: 600; font-size: 1.3rem; color: var(--primary); }
.brand-en { font-size: .72rem; color: var(--accent); white-space: normal; }

.navbar-toggler { border: 0; font-size: 1.8rem; color: var(--primary); }
.navbar-toggler:focus { box-shadow: none; }
.site-header .nav-link {
  font-weight: 400; color: var(--text);
  padding: .5rem .75rem !important;
  border-radius: .4rem;
  white-space: nowrap;
}
.site-header .nav-link:hover, .site-header .nav-link.active, .site-header .nav-link.show {
  color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 -3px 0 var(--accent);
}
.dropdown-menu { border: 0; border-top: 3px solid var(--accent); border-radius: 0 0 .5rem .5rem; box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.dropdown-item { font-size: .95rem; padding: .45rem 1.1rem; }
.dropdown-item:hover, .dropdown-item:active { background: var(--primary); color: #fff; }
.dropdown-menu-scroll { max-height: 70vh; overflow-y: auto; }
@media (min-width: 1200px) {
  .site-header .dropdown:hover > .dropdown-menu { display: block; margin-top: 0; }
}

/* ---------- Hero ---------- */
.hero { position: relative; background: var(--primary-dark); }
/* แสดงภาพสไลด์เต็มภาพตามสัดส่วน 1920x700 (ไม่ตัดขอบ เพราะภาพมักมีข้อความ) */
.hero .carousel-item img { width: 100%; height: auto; aspect-ratio: 1920 / 700; object-fit: cover; display: block; }
.hero .carousel-caption { background: rgba(0,0,0,.45); border-radius: .5rem; padding: .5rem 1rem; bottom: 1.5rem; }
.hero-default {
  min-height: clamp(260px, 38vw, 460px);
  background:
    linear-gradient(115deg, transparent 0 60%, var(--accent) 60% 63%, transparent 63% 66%, color-mix(in srgb, var(--accent) 55%, transparent) 66% 67%, transparent 67%),
    linear-gradient(120deg, var(--primary), var(--primary-dark)),
    repeating-linear-gradient(45deg, rgba(255,255,255,.04) 0 2px, transparent 2px 18px);
  color: #fff; display: flex; align-items: center;
}
.hero-default h1 { font-weight: 600; font-size: clamp(1.8rem, 4vw, 3rem); }
.hero-default .slogan { color: var(--on-dark); font-size: clamp(1rem, 2vw, 1.4rem); }

.director-card {
  background: #fff; border-radius: 1rem; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem;
  color: var(--text);
}
.director-card img, .director-card .ph {
  width: 84px; height: 100px; object-fit: cover; border-radius: .5rem;
  background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 2.4rem; flex-shrink: 0;
}
.director-card .small { color: var(--muted); }

/* ---------- Sections ---------- */
.section { padding: 3.5rem 0; }
.section-alt { background: var(--bg-alt); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.section-title { font-weight: 600; color: var(--primary); margin: 0; position: relative; padding-left: .9rem; }
.section-title::before { content: ''; position: absolute; left: 0; top: .15em; bottom: .15em; width: 5px; border-radius: 3px; background: var(--accent); }
.section-sub { color: var(--muted); margin: 0; font-size: .95rem; }

.page-banner {
  background:
    linear-gradient(115deg, transparent 0 72%, var(--accent) 72% 74%, transparent 74%),
    linear-gradient(120deg, var(--primary), var(--primary-dark));
  color: #fff; padding: 2.2rem 0;
  border-bottom: 4px solid var(--accent);
}
.page-banner h1 { font-weight: 600; font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0; }
.page-banner .breadcrumb { margin: .4rem 0 0; }
.page-banner .breadcrumb a, .page-banner .breadcrumb-item.active, .page-banner .breadcrumb-item + .breadcrumb-item::before { color: rgba(255,255,255,.8); }

/* ---------- Downloads strip ---------- */
.dl-strip { background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 80%, #000)); color: #fff; }
.dl-item {
  display: flex; gap: .75rem; align-items: center;
  color: #fff; text-decoration: none; padding: 1rem .5rem; height: 100%;
  border-right: 1px solid rgba(255,255,255,.15);
}
.dl-item:hover { color: #fff; background: rgba(0,0,0,.12); }
.dl-item i { font-size: 1.8rem; color: #fff; }
.dl-item .t { font-size: .9rem; line-height: 1.3; }

/* ---------- News ---------- */
.news-card {
  border: 0; border-radius: .8rem; overflow: hidden; height: 100%;
  box-shadow: 0 3px 14px rgba(0,0,0,.07);
  border-top: 4px solid var(--primary);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.news-card:hover { transform: translateY(-4px); box-shadow: 0 10px 26px rgba(0,0,0,.12); border-top-color: var(--accent); }
.news-card .thumb { aspect-ratio: 16/10; background: var(--primary-soft); overflow: hidden; display: block; }
.news-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.news-card .thumb .ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 3rem; color: color-mix(in srgb, var(--primary) 35%, #fff); }
.news-card .card-title { font-size: 1rem; font-weight: 500; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-card .card-title a { color: var(--text); text-decoration: none; }
.news-card .card-title a:hover { color: var(--accent); }
.news-meta { font-size: .8rem; color: var(--muted); }
.cat-badge { font-size: .72rem; font-weight: 400; color: #fff; padding: .25em .6em; border-radius: 2rem; }

.announce-list .item {
  display: flex; gap: 1rem; padding: .9rem 0; border-bottom: 1px dashed #ddd;
}
.announce-list .item:last-child { border-bottom: 0; }
.announce-list .date-box {
  flex-shrink: 0; width: 60px; text-align: center; border-radius: .5rem; overflow: hidden;
  border: 1px solid #e3d6d6; background: #fff; align-self: flex-start;
}
.announce-list .date-box .d { font-size: 1.4rem; font-weight: 600; color: var(--primary); line-height: 1.4; }
.announce-list .date-box .m { background: var(--accent); color: #fff; font-size: .72rem; padding: 1px 0; }
.announce-list a.t { color: var(--text); text-decoration: none; font-weight: 400; }
.announce-list a.t:hover { color: var(--accent); }
.pin { color: var(--accent); }

.article { font-family: 'Sarabun', 'Kanit', sans-serif; font-size: 1.05rem; line-height: 1.85; }
.article img { max-width: 100%; height: auto; border-radius: .4rem; }
.article table { width: 100%; }
.gallery a { display: block; aspect-ratio: 4/3; overflow: hidden; border-radius: .5rem; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.gallery a:hover img { transform: scale(1.06); }

/* ---------- Director message ---------- */
.director-photo { aspect-ratio: 3/4; max-width: 240px; margin: 0 auto; border-radius: 1rem; overflow: hidden; background: var(--primary-soft); box-shadow: 0 10px 30px rgba(0,0,0,.12); border-bottom: 5px solid var(--accent); }
.director-photo img { width: 100%; height: 100%; object-fit: cover; }
.director-photo .ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 5rem; color: color-mix(in srgb, var(--primary) 35%, #fff); }
.director-quote { font-family: 'Sarabun', 'Kanit', sans-serif; font-size: 1.08rem; line-height: 1.9; color: #444; border-left: 4px solid var(--accent); padding-left: 1rem; margin: 0 0 1rem; text-indent: 2em; }

/* ---------- News tabs ---------- */
.news-tabs { gap: .4rem; flex-wrap: nowrap; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: thin; }
.news-tabs .nav-link { white-space: nowrap; border-radius: 2rem; color: var(--text); background: #fff; border: 1px solid #e5dcdc; font-size: .92rem; padding: .35rem 1rem; }
.news-tabs .nav-link.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Videos ---------- */
.video-card { display: block; text-decoration: none; color: var(--text); }
.video-card .vthumb { position: relative; display: block; aspect-ratio: 16/9; border-radius: .6rem; overflow: hidden; background: #000; }
.video-card .vthumb img { width: 100%; height: 100%; object-fit: cover; opacity: .9; transition: transform .3s, opacity .3s; }
.video-card .vthumb i { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 2.2rem; text-shadow: 0 2px 10px rgba(0,0,0,.5); }
.video-card.large .vthumb i { font-size: 4rem; }
.video-card:hover img { transform: scale(1.05); opacity: 1; }
.video-card .vtitle { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .88rem; margin-top: .4rem; line-height: 1.4; }
.video-card.large .vtitle { font-size: 1.05rem; font-weight: 500; }
.video-card:hover .vtitle { color: var(--primary); }
.fb-embed { background: #fff; border-radius: .8rem; overflow: hidden; box-shadow: 0 3px 14px rgba(0,0,0,.07); max-width: 500px; margin: 0 auto; }
.fb-embed iframe { width: 100%; height: 560px; border: 0; display: block; }

/* ---------- Calendar ---------- */
.cal { table-layout: fixed; background: #fff; }
.cal th { background: var(--primary); color: #fff; font-weight: 400; text-align: center; font-size: .85rem; }
.cal td { height: 96px; vertical-align: top; padding: .3rem; font-size: .78rem; }
.cal td.other { background: #faf8f7; color: #bbb; }
.cal td.today { background: var(--primary-soft); }
.cal .dnum { font-weight: 500; font-size: .85rem; }
.cal td.today .dnum { background: var(--primary); color: #fff; border-radius: 50%; width: 1.6em; height: 1.6em; display: inline-flex; align-items: center; justify-content: center; }
.cal .ev { display: block; color: #fff; border-radius: .25rem; padding: 1px 4px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
@media (max-width: 767.98px) { .cal td { height: 56px; } .cal .ev { font-size: 0; height: 6px; padding: 0; } }

/* ---------- E-service ---------- */
.service-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .6rem;
  background: #fff; border-radius: .8rem; padding: 1.3rem .75rem; height: 100%;
  color: var(--text); text-decoration: none; box-shadow: 0 3px 12px rgba(0,0,0,.06);
  transition: all .2s; font-size: .92rem;
}
.service-item i {
  width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary); font-size: 1.6rem; transition: all .2s;
}
.service-item:hover { color: var(--accent); transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,.1); }
.service-item:hover i { background: var(--accent); color: #fff; }

/* ---------- Stats ---------- */
.stats-band { background: linear-gradient(120deg, var(--primary-dark), var(--primary)); color: #fff; border-top: 5px solid var(--accent); border-bottom: 5px solid var(--accent); }
.stat-box { text-align: center; padding: 1.2rem .5rem; }
.stat-box .num { font-size: clamp(2rem, 5vw, 2.8rem); font-weight: 600; color: #fff; line-height: 1.1; }
.stat-box .lbl { opacity: .9; border-top: 3px solid var(--accent); display: inline-block; padding-top: .3rem; margin-top: .3rem; }

.stat-card { border: 0; border-radius: .8rem; box-shadow: 0 3px 14px rgba(0,0,0,.07); }
.stat-card .num { font-size: 2rem; font-weight: 600; color: var(--primary); }
.table-stats th { background: var(--primary); color: #fff; font-weight: 400; white-space: nowrap; }
.table-stats tfoot td { font-weight: 600; background: var(--accent-soft); color: var(--accent); }

/* ---------- Personnel ---------- */
.person-card {
  border: 0; border-radius: .8rem; text-align: center; height: 100%;
  box-shadow: 0 3px 14px rgba(0,0,0,.07); overflow: hidden;
  border-bottom: 4px solid var(--accent);
}
.person-card .photo { aspect-ratio: 3/4; background: var(--primary-soft); overflow: hidden; }
.person-card .photo img { width: 100%; height: 100%; object-fit: cover; }
.person-card .photo .ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 4rem; color: color-mix(in srgb, var(--primary) 35%, #fff); }
.person-card .name { font-weight: 500; font-size: 1rem; }
.person-card .pos { font-size: .85rem; color: var(--primary); }
.person-card .meta { font-size: .8rem; color: var(--muted); }
.person-lead { max-width: 260px; margin: 0 auto; }
.filter-pills .btn { border-radius: 2rem; font-size: .88rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 6px solid; border-image: var(--college-stripe) 1; background: color-mix(in srgb, var(--primary) 40%, #000); color: rgba(255,255,255,.85); font-size: .95rem; }
.site-footer .footer-title { color: var(--on-dark); font-weight: 500; margin-bottom: 1rem; }
.footer-links li { margin-bottom: .45rem; }
.footer-links a { color: rgba(255,255,255,.8); text-decoration: none; }
.footer-links a::before { content: '\203A'; margin-right: .4rem; color: var(--on-dark); }
.footer-links a:hover { color: #fff; }
.footer-bottom { background: var(--accent); padding: .8rem 0; font-size: .85rem; }

.back-top {
  position: fixed; right: 1rem; bottom: 1rem; width: 44px; height: 44px; border-radius: 50%;
  background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 1030; box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.back-top.show { opacity: 1; pointer-events: auto; }
.back-top:hover { color: #fff; background: var(--primary-dark); }

@media (max-width: 1199.98px) {
  .site-header .navbar-collapse { max-height: 75vh; overflow-y: auto; padding-bottom: .75rem; }
}
@media (max-width: 991.98px) {
  .brand-th { font-size: 1.1rem; }
  .dl-item { border-right: 0; border-bottom: 1px solid rgba(255,255,255,.15); }
}
@media (max-width: 575.98px) {
  .brand-logo { width: 44px; height: 44px; }
  .brand-en { display: none; }
  .section { padding: 2.5rem 0; }
}

/* ---------- ไล่โทนสีประจำวิทยาลัย น้ำเงิน → แดง ----------
   ไล่สีใน oklab เพื่อให้ช่วงกลางไม่หม่น; ใช้ background-image คู่กับ background-color
   เพื่อให้เบราว์เซอร์เก่าที่ไม่รองรับยังเห็นสีพื้นเดิม */
:root {
  --blend: color-mix(in oklab, var(--primary) 55%, var(--accent));
  --grad-line: linear-gradient(90deg in oklab, var(--primary), var(--blend), var(--accent));
  --grad-line-v: linear-gradient(180deg in oklab, var(--primary), var(--accent));
  --grad-deep: linear-gradient(120deg in oklab, var(--primary-dark) 0%, var(--primary) 50%, color-mix(in oklab, var(--primary) 55%, var(--accent)) 100%);
  --grad-warm: linear-gradient(90deg in oklab, var(--accent), color-mix(in oklab, var(--accent) 55%, var(--primary)));
  --grad-btn: linear-gradient(135deg in oklab, var(--primary), color-mix(in oklab, var(--primary) 60%, var(--accent)));
  --grad-dark: linear-gradient(135deg in oklab, color-mix(in oklab, var(--primary) 45%, #000) 0%, color-mix(in oklab, var(--primary) 38%, #000) 55%, color-mix(in oklab, var(--accent) 40%, #000) 100%);
  --college-stripe: var(--grad-line);
}

.ticker { background-color: var(--accent); background-image: var(--grad-warm); }
.ticker-label { background-color: var(--primary); background-image: var(--grad-btn); }
.topbar { background-color: var(--primary-dark); background-image: linear-gradient(90deg in oklab, var(--primary-dark), color-mix(in oklab, var(--primary-dark) 75%, var(--accent))); border-bottom: 3px solid; border-image: var(--grad-line) 1; }
.btn-cta { background-color: var(--accent); background-image: linear-gradient(135deg in oklab, var(--accent), color-mix(in oklab, var(--accent) 65%, var(--primary))); }

.hero-default { background-color: var(--primary); background-image: var(--grad-deep); }
.page-banner { background-color: var(--primary); background-image: var(--grad-deep); border-bottom: 4px solid; border-image: var(--grad-line) 1; }
.dl-strip { background-color: var(--accent); background-image: var(--grad-warm); }
.stats-band { background-color: var(--primary); background-image: var(--grad-deep); border-top: 0; border-bottom: 5px solid; border-image: var(--grad-line) 1; }
.site-footer { background-color: color-mix(in srgb, var(--primary) 40%, #000); background-image: var(--grad-dark); }
.footer-bottom { background-color: var(--accent); background-image: var(--grad-line); }

.btn-primary { background-image: var(--grad-btn); border-color: transparent; }
.btn-primary:hover, .btn-primary:focus { background-image: linear-gradient(135deg in oklab, var(--primary-dark), var(--blend)); border-color: transparent; }
.news-tabs .nav-link.active, .filter-pills .btn-primary { background-image: var(--grad-btn); border-color: transparent; }
.back-top { background-color: var(--primary); background-image: linear-gradient(135deg in oklab, var(--primary), var(--accent)); }
.cal th { background-color: var(--primary); background-image: var(--grad-btn); }
.table-stats th { background-color: var(--primary); background-image: var(--grad-btn); }

.section-title::before { background-color: var(--accent); background-image: var(--grad-line-v); }
.director-quote { border-left: 4px solid; border-image: var(--grad-line-v) 1; }
.director-photo { border-bottom: 0; }
.director-photo::after { content: ''; display: block; height: 5px; margin-top: -5px; position: relative; background-image: var(--grad-line); }
.announce-list .date-box .m { background-color: var(--accent); background-image: var(--grad-line); }
.service-item:hover i { background-color: var(--accent); background-image: linear-gradient(135deg in oklab, var(--primary), var(--accent)); }

/* แถบไล่สีบนการ์ด: เลื่อนไปทางแดงเมื่อชี้ */
.news-card { border-top: 0; }
.news-card::before, .person-card::after {
  content: ''; display: block; height: 4px; flex-shrink: 0;
  background-color: var(--primary);
  background-image: linear-gradient(90deg in oklab, var(--primary), var(--blend), var(--accent), var(--blend), var(--primary));
  background-size: 200% 100%; transition: background-position .4s;
}
.news-card:hover::before, .person-card:hover::after { background-position: 100% 0; }
.person-card { border-bottom: 0; }
.stat-card { position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background-color: var(--accent); background-image: var(--grad-line-v); }
/* ---------- ปุ่มติดต่อลอย (Messenger / Facebook / LINE / โทร) ---------- */
.contact-fab { position: fixed; right: 1rem; bottom: 4.6rem; z-index: 1040; display: flex; flex-direction: column; align-items: flex-end; gap: .75rem; }
.contact-fab-btn {
  position: relative; width: 58px; height: 58px; border-radius: 50%; border: 3px solid #fff; color: #fff; font-size: 1.6rem;
  background: #0866ff; background-image: radial-gradient(circle at 25% 110%, #ffc300 0%, #ff5c87 35%, #a033ff 65%, #0866ff 100%);
  box-shadow: 0 6px 18px rgba(0,0,0,.28); display: flex; align-items: center; justify-content: center; transition: transform .2s;
}
.contact-fab-btn:hover { transform: scale(1.07); }
.contact-fab-btn::before {
  content: ''; position: absolute; inset: -3px; border-radius: 50%; border: 3px solid #a033ff;
  animation: fab-pulse 2.2s ease-out infinite; pointer-events: none;
}
.contact-fab-btn .ic-close, .contact-fab.open .contact-fab-btn .ic-open { display: none; }
.contact-fab.open .contact-fab-btn .ic-close { display: inline; font-size: 1.3rem; }
.contact-fab.open .contact-fab-btn::before { animation: none; opacity: 0; }
@keyframes fab-pulse { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.55); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .contact-fab-btn::before { animation: none; opacity: 0; } }

.contact-panel {
  width: min(320px, calc(100vw - 2rem)); background: #fff; border-radius: 1rem; overflow: hidden;
  box-shadow: 0 14px 40px rgba(0,0,0,.25); animation: panel-in .18s ease-out; transform-origin: bottom right;
}
@keyframes panel-in { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
.contact-panel-head { display: flex; gap: .75rem; align-items: center; padding: .9rem 1rem; color: #fff;
  background-color: var(--primary); background-image: linear-gradient(120deg in oklab, var(--primary), var(--blend, var(--primary)), var(--accent)); }
.contact-panel-head img { width: 44px; height: 44px; object-fit: contain; background: #fff; border-radius: 50%; padding: 2px; flex-shrink: 0; }
.contact-panel-body { padding: .5rem; display: grid; gap: .15rem; }
.cp-item { display: flex; gap: .75rem; align-items: center; padding: .55rem .6rem; border-radius: .6rem; color: var(--text); text-decoration: none; }
.cp-item:hover { background: var(--bg-alt); color: var(--text); }
.cp-item b { display: block; font-weight: 500; font-size: .95rem; }
.cp-item small { display: block; color: var(--muted); font-size: .78rem; overflow-wrap: anywhere; }
.cp-ic { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.2rem; }
.cp-ic.messenger { background-image: radial-gradient(circle at 25% 110%, #ffc300 0%, #ff5c87 35%, #a033ff 65%, #0866ff 100%); }
.cp-ic.facebook { background: #1877f2; }
.cp-ic.line { background: #06c755; }
.cp-ic.phone { background: var(--accent); }
.cp-ic.form { background: var(--primary); }
/* ---------- PDPA: แถบแจ้งคุกกี้ / กล่องขออนุญาตแสดงสื่อภายนอก ---------- */
.pdpa-banner {
  position: fixed; left: 1rem; bottom: 1rem; z-index: 1060; width: min(560px, calc(100vw - 2rem));
  background: #fff; color: var(--text); border-radius: 1rem; padding: 1.1rem 1.25rem;
  box-shadow: 0 14px 40px rgba(0,0,0,.25); border-top: 5px solid; border-image: var(--grad-line) 1;
}
.pdpa-banner a { color: var(--primary); }
@media (max-width: 575.98px) {
  .pdpa-banner { left: .5rem; right: .5rem; bottom: .5rem; width: auto; }
  body.pdpa-pending .contact-fab, body.pdpa-pending .back-top { display: none; }
}
.pdpa-option { padding: .75rem 0; border-bottom: 1px solid #eee; }
.pdpa-option:last-child { border-bottom: 0; }
.consent-embed { width: 100%; height: 100%; min-height: 220px; display: flex; align-items: center; justify-content: center;
  background: var(--bg-alt); color: var(--text); text-align: center; padding: 1.25rem; }
.fb-embed .consent-embed { min-height: 560px; }
.consent-ph { display: grid; gap: .6rem; justify-items: center; max-width: 380px; font-size: .92rem; }
.consent-ph > i { font-size: 2rem; color: var(--primary); }
.video-holder .consent-embed { background: #111; color: #eee; }
.video-holder .consent-ph a { color: #9ec5fe; }
.fb-embed iframe { min-height: 560px; }
.footer-legal { display: inline-flex; flex-wrap: wrap; gap: .25rem 1rem; }
.footer-legal a, .footer-legal button { color: rgba(255,255,255,.8); text-decoration: none; background: none; border: 0; padding: 0; font-size: inherit; }
.footer-legal a:hover, .footer-legal button:hover { color: #fff; text-decoration: underline; }
/* ---------- แผนที่วิทยาลัย (หน้าแรก คู่กับ Facebook) ---------- */
.map-card { background: #fff; border-radius: .8rem; overflow: hidden; box-shadow: 0 3px 14px rgba(0,0,0,.07); display: flex; flex-direction: column; height: 100%; min-height: 560px; }
.map-frame { flex: 1; min-height: 380px; display: flex; }
.map-frame > iframe, .map-frame > .consent-embed { flex: 1; width: 100%; min-height: 380px; }
.map-info { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem 1rem; padding: 1rem 1.25rem; border-top: 4px solid; border-image: var(--grad-line) 1; }
.map-pin { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.2rem;
  background-color: var(--accent); background-image: linear-gradient(135deg in oklab, var(--primary), var(--accent)); }
@media (max-width: 991.98px) { .map-card { min-height: 0; } }
/* รายชื่อวิทยาลัยในจังหวัด (ท้ายเว็บ): ชื่อที่ยังไม่มีลิงก์ และวิทยาลัยของเราเอง */
.footer-links li > span { color: rgba(255,255,255,.8); }
.footer-links li > span::before { content: '\203A'; margin-right: .4rem; color: var(--on-dark); }
.footer-links li.is-self a, .footer-links li.is-self span { color: #fff; font-weight: 500; }
.footer-links li.is-self a::before { content: '\25CF'; font-size: .6em; vertical-align: middle; }
/* ---------- กล่อง Facebook: ส่วนหัวเพจ + โพสต์ล่าสุด ---------- */
.fb-box { background: #fff; border-radius: .8rem; overflow: hidden; box-shadow: 0 3px 14px rgba(0,0,0,.07); display: flex; flex-direction: column; height: 100%; min-height: 560px; }
.fb-head { height: 130px; display: flex; border-bottom: 1px solid #eee; }
.fb-head > iframe, .fb-head > .consent-embed { flex: 1; width: 100%; height: 130px; min-height: 130px; }
.fb-head .consent-embed { padding: .5rem; }
.fb-head .consent-ph { gap: .3rem; font-size: .82rem; }
.fb-head .consent-ph > i { font-size: 1.2rem; }
.fb-feed { flex: 1; padding: .75rem 1rem; display: grid; gap: .25rem; align-content: start; overflow-y: auto; max-height: 360px; }
.fb-feed-title { font-weight: 500; color: var(--primary); font-size: .92rem; margin-bottom: .25rem; }
.fb-feed-title .bi-facebook { color: #1877f2; }
.fb-post { display: flex; gap: .75rem; align-items: flex-start; padding: .55rem; border-radius: .5rem; color: var(--text); text-decoration: none; }
.fb-post:hover { background: var(--bg-alt); color: var(--text); }
.fb-post img { width: 72px; height: 72px; object-fit: cover; border-radius: .4rem; flex-shrink: 0; background: var(--bg-alt); }
.fb-post-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: .88rem; line-height: 1.45; }
.fb-post small { display: block; color: var(--muted); font-size: .75rem; margin-top: .2rem; }
.fb-more { margin: 0 1rem 1rem; }
@media (max-width: 991.98px) { .fb-box { min-height: 0; } .fb-feed { max-height: none; } }
/* โพสต์แนะนำ (ปลั๊กอินโพสต์ของ Facebook) เลื่อนดูในกล่อง */
.fb-feed-embeds { max-height: 430px; gap: .75rem; }
.fb-embed-post { height: 400px; display: flex; border-radius: .5rem; overflow: hidden; background: var(--bg-alt); flex-shrink: 0; }
.fb-embed-post > iframe, .fb-embed-post > .consent-embed { flex: 1; width: 100%; height: 100%; min-height: 0; }
/* ---------- กล่องช่อง YouTube (หน้าแรก ข้าง Facebook) ---------- */
.yt-box { background: #fff; border-radius: .8rem; overflow: hidden; box-shadow: 0 3px 14px rgba(0,0,0,.07); display: flex; flex-direction: column; height: 100%; min-height: 560px; }
.yt-head { display: flex; align-items: center; gap: .75rem; padding: .9rem 1rem; border-bottom: 1px solid #eee; min-height: 130px; }
.yt-avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 2px solid #eee; }
.min-w-0 { min-width: 0; }
.btn-yt { background: #ff0000; border-color: #ff0000; color: #fff; }
.btn-yt:hover, .btn-yt:focus { background: #cc0000; border-color: #cc0000; color: #fff; }
.yt-body { flex: 1; padding: .75rem 1rem; display: grid; gap: .6rem; align-content: start; }
.yt-body .video-card.large .vtitle { font-size: .95rem; }
.yt-list { display: grid; gap: .25rem; }
.yt-item { display: flex; gap: .6rem; align-items: flex-start; padding: .35rem; border-radius: .5rem; color: var(--text); text-decoration: none; }
.yt-item:hover { background: var(--bg-alt); color: var(--text); }
.yt-thumb { position: relative; width: 96px; flex-shrink: 0; aspect-ratio: 16/9; border-radius: .35rem; overflow: hidden; background: #000; }
.yt-thumb img { width: 100%; height: 100%; object-fit: cover; }
.yt-thumb i { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.4rem; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.yt-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .84rem; line-height: 1.4; }
.yt-item small { display: block; color: var(--muted); font-size: .72rem; margin-top: .15rem; }
.yt-more { margin: 0 1rem 1rem; }
@media (max-width: 1199.98px) { .yt-box, .fb-box { min-height: 0; } }
/* ---------- การ์ดเว็บไซต์เดิม (ข้างแผนที่) ---------- */
.oldsite-card { background: #fff; border-radius: .8rem; overflow: hidden; box-shadow: 0 3px 14px rgba(0,0,0,.07); display: flex; flex-direction: column; height: 100%; }
.oldsite-preview { flex: 1; display: flex; flex-direction: column; background: var(--bg-alt); text-decoration: none; overflow: hidden; min-height: 380px; }
.oldsite-bar { display: flex; align-items: center; gap: .35rem; padding: .45rem .75rem; background: #e9ecef; font-size: .78rem; color: var(--muted); }
.oldsite-bar > i { width: 10px; height: 10px; border-radius: 50%; background: #ff5f57; }
.oldsite-bar > i:nth-child(2) { background: #febc2e; }
.oldsite-bar > i:nth-child(3) { background: #28c840; }
.oldsite-bar > span { margin-left: .5rem; background: #fff; border-radius: 1rem; padding: .1rem .75rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oldsite-preview img { flex: 1; width: 100%; object-fit: cover; object-position: top center; transition: transform .4s; min-height: 0; }
.oldsite-preview:hover img { transform: scale(1.03); }
.oldsite-ph { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 4rem; color: color-mix(in srgb, var(--primary) 35%, #fff); }
/* ---------- 4 กล่อง (Facebook / YouTube / แผนที่ / เว็บไซต์เดิม) ในแถวเดียว บนจอกว้าง ---------- */
@media (min-width: 1200px) {
  .fb-box, .yt-box, .map-card, .oldsite-card { height: 480px; min-height: 0; }
  .fb-feed { max-height: none; min-height: 0; padding: .6rem .75rem; }
  .fb-post img { width: 56px; height: 56px; }
  .fb-post-text { -webkit-line-clamp: 2; font-size: .82rem; }
  .fb-more, .yt-more { margin: 0 .75rem .75rem; font-size: .85rem; padding: .35rem .5rem; }
  .yt-head { min-height: 0; padding: .7rem .75rem; gap: .5rem; }
  .yt-avatar { width: 42px; height: 42px; }
  .yt-head .btn-yt { padding: .2rem .5rem; font-size: .78rem; }
  .yt-body { padding: .6rem .75rem; gap: .45rem; overflow: hidden; min-height: 0; }
  .yt-body .video-card.large .vtitle { font-size: .85rem; -webkit-line-clamp: 1; }
  .yt-thumb { width: 80px; }
  .yt-title { font-size: .78rem; }
  .map-frame, .map-frame > iframe, .map-frame > .consent-embed { min-height: 0; }
  .oldsite-preview { min-height: 0; }
  .map-info { padding: .7rem .75rem; flex-direction: column; align-items: stretch; gap: .5rem; }
  .map-info .map-pin { width: 32px; height: 32px; font-size: 1rem; }
  .map-info .small { font-size: .75rem; line-height: 1.35; }
  .map-info .btn { font-size: .78rem; padding: .25rem .5rem; }
  .map-info > .d-flex.flex-wrap { flex-wrap: nowrap !important; }
  .map-info > .d-flex.flex-wrap .btn { flex: 1; white-space: nowrap; }
  .map-info > .btn { align-self: stretch; }
}
/* ---------- แถบสถิติหน้าแรก: คลิกไปหน้า Dashboard ---------- */
a.stat-box { display: block; color: #fff; text-decoration: none; border-radius: 1rem; transition: background-color .2s, transform .2s; }
a.stat-box:hover, a.stat-box:focus-visible { color: #fff; background-color: rgba(255,255,255,.1); transform: translateY(-3px); }
a.stat-box .go { display: block; font-size: .8rem; opacity: 0; transition: opacity .2s; margin-top: .3rem; }
a.stat-box:hover .go, a.stat-box:focus-visible .go { opacity: .85; }

/* ---------- Dashboard ข้อมูลผู้เรียน ---------- */
.dash { background: var(--bg-alt); }
.dash-hero { color: #fff; border-radius: 1.2rem; padding: 1.5rem; background-color: var(--primary); background-image: var(--grad-deep); box-shadow: 0 10px 30px color-mix(in srgb, var(--primary) 30%, transparent); position: relative; overflow: hidden; }
.dash-hero::after { content: ''; position: absolute; right: -60px; bottom: -60px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255,255,255,.07); }
.dash-hero .big { font-size: clamp(2.8rem, 7vw, 4rem); font-weight: 600; line-height: 1; margin: .3rem 0; }
.dash-hero .lbl { opacity: .85; }
.dash-hero-icon { font-size: 3rem; opacity: .25; }
.dash-delta { display: inline-block; background: rgba(255,255,255,.15); border-radius: 2rem; padding: .2rem .8rem; font-size: .85rem; }
.dash-split { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: rgba(255,255,255,.2); }
.dash-split .m { background: #8fb4ff; }
.dash-split .f { background: #ff9aa0; }
.dash-kpi { display: flex; align-items: center; gap: 1rem; background: #fff; border-radius: 1rem; padding: 1.1rem 1.2rem; box-shadow: 0 3px 14px rgba(0,0,0,.06); color: var(--text); text-decoration: none; transition: transform .2s, box-shadow .2s; }
a.dash-kpi:hover { color: var(--text); transform: translateY(-3px); box-shadow: 0 8px 22px rgba(0,0,0,.1); }
.dash-kpi .ic { flex: 0 0 52px; height: 52px; border-radius: .9rem; display: grid; place-items: center; font-size: 1.5rem; color: #fff; background-color: var(--primary); background-image: var(--grad-btn); }
.dash-kpi .num { font-size: 1.9rem; font-weight: 600; color: var(--primary); line-height: 1.1; }
.dash-kpi .lbl { color: var(--muted); font-size: .9rem; }
.dash-card { background: #fff; border-radius: 1rem; padding: 1.2rem; box-shadow: 0 3px 14px rgba(0,0,0,.06); }
.dash-card h3 { font-size: 1rem; font-weight: 500; color: var(--primary); margin-bottom: 1rem; }
.dash-card h3 .bi { color: var(--accent); }
.dash-donut { height: 200px; }
.dash-empty { height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; color: var(--muted); }
.dash-empty .bi { font-size: 2rem; opacity: .5; }
.dash-rank { display: flex; align-items: center; gap: .8rem; padding: .55rem 0; border-bottom: 1px dashed #e5e7eb; }
.dash-rank .no { flex: 0 0 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: .85rem; font-weight: 600; color: var(--primary); background: var(--primary-soft); }
.col-md-6:nth-child(-n+3) .dash-rank .no { color: #fff; background-color: var(--accent); background-image: var(--grad-warm); }
.dash-rank .bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: #eef1f6; margin-top: .3rem; }
.dash-rank .bar .m { background: var(--primary); }
.dash-rank .bar .f { background: var(--accent); }
.min-w-0 { min-width: 0; }
