/* Home page — option B.1 "Light institutional: search bar and cards" */
:root {
  --ink: #0B1F3F; --navy: #12305F; --blue: #1A4FBF; --tint: #EAF1FD;
  --ground: #F5F7FA; --line: #D5DEEA; --line-soft: #E4EAF2; --line-strong: #B8C5D8;
  --muted: #4A5A72; --text-2: #2B3B57; --out-bg: #FFF4DC; --out-ink: #6B4000; --focus: #F2B33D;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; font-family: "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, sans-serif; font-size: 16px; line-height: 1.65; color: var(--ink); background: #fff; }
h1, h2, h3, p { margin: 0; }
a { color: var(--blue); }
a:hover { color: var(--navy); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: 16px; top: -60px; background: #fff; color: var(--navy); padding: 10px 16px; border-radius: 8px; font-weight: 600; z-index: 20; }
.skip:focus { top: 8px; }

/* utility bar */
.util { background: var(--ground); color: var(--muted); font-size: 14px; border-bottom: 1px solid var(--line-soft); }
.util .wrap { display: flex; flex-wrap: wrap; gap: 4px 24px; justify-content: space-between; align-items: center; padding-top: 8px; padding-bottom: 8px; }
.util-links { display: flex; flex-wrap: wrap; gap: 4px 24px; }
.util a { color: var(--muted); text-decoration: none; }
.util a:hover { color: var(--navy); text-decoration: underline; }
.util a.strong { color: var(--blue); font-weight: 600; }

/* header */
.site-header { background: #fff; border-bottom: 2px solid var(--navy); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; justify-content: space-between; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--ink); }
.brand img { height: 48px; width: auto; display: block; }
.brand-name { display: flex; flex-direction: column; line-height: 1.35; border-left: 1px solid var(--line-strong); padding-left: 14px; }
.brand-name b { font-weight: 600; }
.brand-name span { font-size: 13px; color: var(--muted); }
.nav { display: flex; flex-wrap: wrap; gap: 4px 26px; align-items: center; font-weight: 500; }
.nav a { color: var(--ink); text-decoration: none; padding: 8px 0; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--blue); }
.nav a[aria-current="page"] { color: var(--blue); border-bottom-color: var(--blue); }
.menu-btn { display: none; width: 44px; height: 44px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--ink); cursor: pointer; align-items: center; justify-content: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 8px; border: 0; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background-color .18s ease; }
.nav a.btn-navy, .btn-navy { background: var(--navy); color: #fff; padding: 0 18px; border-bottom: 0; }
.nav a.btn-navy:hover, .btn-navy:hover { background: var(--ink); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; min-height: 48px; }
.btn-blue:hover { background: var(--navy); color: #fff; }

/* hero */
.hero { background: var(--tint); text-align: center; }
.hero .wrap { padding-top: 52px; padding-bottom: 88px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.eyebrow { font-size: 14px; font-weight: 600; letter-spacing: 1.5px; color: var(--navy); }
.hero h1 { font-size: clamp(28px, 3.6vw, 44px); line-height: 1.35; font-weight: 700; max-width: 1000px; }
.hero h1 span { color: var(--blue); }
.hero p { font-size: 18px; color: var(--text-2); max-width: 820px; }

/* search bar overlapping the hero */
.searchbar { margin-top: -52px; background: #fff; border: 1px solid var(--line-strong); border-radius: 12px; padding: 20px 24px; box-shadow: 0 8px 24px rgba(11,31,63,.08); display: flex; flex-direction: column; gap: 12px; position: relative; }
.fields { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 180px; min-width: 0; }
.field.grow { flex: 2.2 1 300px; }
.field label { font-size: 14px; font-weight: 600; }
.field input, .field select { width: 100%; height: 48px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 14px; font: inherit; color: var(--ink); background: #fff; }
.field input:hover, .field select:hover { border-color: var(--navy); }
.fields .btn { flex: 0 0 auto; padding: 0 22px; }
.popular { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); }
.popular a { border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px 14px; color: var(--navy); text-decoration: none; }
.popular a:hover { background: var(--tint); border-color: var(--blue); }

/* sections */
.section { padding-top: 48px; padding-bottom: 8px; }
.section-head { display: flex; flex-wrap: wrap; gap: 6px 24px; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }
h2 { font-size: 26px; line-height: 1.4; font-weight: 700; }
.head-links { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.head-links a { font-weight: 600; text-decoration: none; padding: 6px 0; }
.head-links a:hover { text-decoration: underline; }

/* measure cards */
.mgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.mcard { border: 1px solid var(--line); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 8px; background: #fff; }
.mcard .code { align-self: flex-start; font-weight: 700; font-size: 14px; color: var(--navy); background: var(--tint); border-radius: 6px; padding: 2px 12px; }
.mcard h3 { font-size: 18px; line-height: 1.4; font-weight: 700; }
.mcard p { color: var(--muted); font-size: 15px; flex: 1; }
.mcard .links { display: flex; gap: 18px; font-weight: 600; }
.mcard .links a { text-decoration: none; padding: 8px 0; }
.mcard .links a:hover { text-decoration: underline; }

/* services band */
.band { margin-top: 40px; background: var(--ground); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); padding: 36px 0 40px; }
.band h2 { margin-bottom: 16px; }
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 12px; text-align: center; font-weight: 600; color: var(--ink); text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 10px; transition: border-color .18s ease, box-shadow .18s ease; }
.tile:hover { border-color: var(--blue); color: var(--ink); box-shadow: 0 6px 18px rgba(11,31,63,.08); }
.tile .ic { width: 44px; height: 44px; border-radius: 10px; background: var(--tint); color: var(--blue); display: flex; align-items: center; justify-content: center; }

/* notices */
.notices { border-top: 2px solid var(--navy); margin-bottom: 64px; }
.notices a { display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--line-soft); text-decoration: none; color: var(--ink); }
.notices a:hover { background: var(--ground); }
.notices .date { flex: none; width: 96px; font-size: 14px; color: var(--muted); }
.notices .title { flex: 1 1 320px; font-weight: 500; }
.tag { flex: none; font-size: 13px; font-weight: 600; color: var(--navy); background: var(--tint); border-radius: 999px; padding: 2px 12px; }
.tag.out { color: var(--out-ink); background: var(--out-bg); }

/* footer */
.site-footer { background: var(--navy); color: #D5DEEA; font-size: 15px; }
.site-footer .cols { display: flex; flex-wrap: wrap; gap: 28px 64px; padding-top: 44px; padding-bottom: 28px; }
.site-footer .col { flex: 1 1 180px; display: flex; flex-direction: column; gap: 6px; }
.site-footer .col.wide { flex: 2 1 320px; }
.site-footer b { color: #fff; font-size: 16px; }
.site-footer a { color: #D5DEEA; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer .legal { border-top: 1px solid #2B4A7D; padding-top: 14px; padding-bottom: 24px; font-size: 14px; }

@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .menu-btn { display: flex; }
  .nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 0; padding-top: 4px; }
  .nav.open { display: flex; }
  .nav a { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
  .nav a[aria-current="page"] { border-bottom-color: var(--line-soft); }
  .nav a.btn-navy { margin-top: 10px; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .util .wrap > span { display: none; }
  .brand img { height: 40px; }
  .brand-name span { display: none; }
  .hero .wrap { padding-top: 32px; padding-bottom: 76px; }
  .hero p { font-size: 16px; }
  .searchbar { padding: 16px; }
  .fields .btn { flex: 1 1 100%; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notices .date { width: auto; }
  .notices .title { flex-basis: 100%; order: 3; }
}

/* ---------- search results page ---------- */
.muted { color: var(--muted); }
.hero-sm { text-align: left; }
.hero-sm .wrap { align-items: flex-start; padding-top: 28px; padding-bottom: 80px; gap: 4px; }
.hero-sm h1 { font-size: clamp(26px, 3vw, 34px); }
.crumbs { font-size: 14px !important; color: var(--muted) !important; }
.crumbs a { text-decoration: none; }
.results { padding-top: 28px; padding-bottom: 64px; display: flex; flex-direction: column; gap: 16px; }
.results .section-head { margin-bottom: 0; }
.banner { background: var(--out-bg); color: var(--out-ink); border: 1px solid #E9CF95; border-radius: 10px; padding: 10px 16px; font-size: 14px; }
.rlist { border-top: 2px solid var(--navy); }
.rlist[hidden], .empty[hidden] { display: none; }
.rlist a { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; padding: 16px 4px; border-bottom: 1px solid var(--line-soft); text-decoration: none; color: var(--ink); }
.rlist a:hover { background: var(--ground); }
.rlist .code { flex: none; min-width: 52px; text-align: center; font-weight: 700; font-size: 14px; color: var(--navy); background: var(--tint); border-radius: 6px; padding: 2px 10px; }
.rlist .title { flex: 1 1 280px; display: flex; flex-direction: column; gap: 2px; }
.rlist .title b { font-weight: 600; font-size: 17px; }
.rlist small { font-size: 14px; color: var(--muted); }
.rlist .meta { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.empty { border: 1px solid var(--line); border-radius: 12px; padding: 40px 24px; display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; }

/* ---------- login page ---------- */
.login-page { background: var(--tint); min-height: 100vh; display: flex; flex-direction: column; }
.login-page .site-header { position: static; }
.back { font-weight: 600; text-decoration: none; padding: 10px 0; }
.login { flex: 1; display: flex; align-items: center; padding: 48px 0 64px; }
.login-grid { width: 100%; display: flex; flex-wrap: wrap; gap: 40px 64px; align-items: center; justify-content: space-between; }
.login-pitch { flex: 1 1 380px; display: flex; flex-direction: column; gap: 18px; }
.login-pitch h1 { font-size: clamp(28px, 3.2vw, 40px); line-height: 1.35; font-weight: 700; }
.login-pitch h1 span { display: block; color: var(--blue); }
.login-pitch ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; color: var(--text-2); font-size: 17px; }
.login-pitch li { display: flex; gap: 12px; align-items: center; }
.login-pitch li svg { flex: none; color: var(--blue); }
.login-card { flex: 0 1 420px; width: 100%; background: #fff; border: 1px solid var(--line-strong); border-radius: 12px; padding: 32px; display: flex; flex-direction: column; gap: 18px; box-shadow: 0 8px 24px rgba(11,31,63,.08); }
.login-card .field { flex: none; }
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 52px; }
.pass-toggle { position: absolute; right: 2px; top: 2px; width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 6px; }
.pass-toggle[aria-pressed="true"] { color: var(--blue); }
.check { display: flex; gap: 10px; align-items: center; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }
.login-btn { width: 100%; min-height: 50px; font-size: 17px; }
.login-note { font-size: 14px; color: var(--muted); text-align: center; }
@media (max-width: 640px) {
  .rlist .meta { flex-direction: row; align-items: center; flex-basis: 100%; }
  .login { padding: 28px 0 40px; align-items: flex-start; }
  .login-pitch ul { display: none; }
  .login-card { padding: 24px 18px; }
}

/* ---------- home: notices + shortcuts, news, feeds, newsletter ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.two-col { display: flex; flex-wrap: wrap; gap: 24px 32px; align-items: flex-start; }
.two-col .notices { flex: 999 1 480px; min-width: 0; margin-bottom: 0; }
.notices .title small { display: block; font-size: 14px; font-weight: 400; color: var(--muted); }
.shortcuts { flex: 1 1 280px; border: 1px solid var(--line); border-radius: 12px; }
.shortcuts h3 { font-size: 17px; font-weight: 700; padding: 14px 18px; border-bottom: 2px solid var(--navy); }
.shortcuts a { display: flex; flex-direction: column; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); text-decoration: none; color: var(--ink); line-height: 1.45; }
.shortcuts a:last-child { border-bottom: 0; }
.shortcuts a:hover { background: var(--ground); }
.shortcuts b { font-weight: 600; }
.shortcuts small { font-size: 14px; color: var(--muted); }

.news { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; }
.news a { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--ink); }
.news .lead { border: 1px solid var(--line); border-radius: 12px; padding: 24px; background: var(--tint); border-color: var(--line-strong); }
.news .lead b { font-size: 21px; line-height: 1.45; font-weight: 700; }
.news .lead .desc { color: var(--text-2); }
.news .rest { display: flex; flex-direction: column; border-top: 2px solid var(--navy); }
.news .rest a { padding: 14px 4px; border-bottom: 1px solid var(--line-soft); }
.news .rest b { font-weight: 600; }
.news a:hover b { color: var(--blue); }
.news .meta { display: flex; gap: 12px; align-items: center; }
.news .date { font-size: 14px; color: var(--muted); }

.feeds { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.feed { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.feed header { display: flex; gap: 12px; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.feed header > span:last-child { display: flex; flex-direction: column; line-height: 1.4; }
.feed header b { font-weight: 700; }
.feed header small { font-size: 13px; color: var(--muted); }
.feed .src { flex: none; width: 48px; height: 44px; border-radius: 8px; background: var(--navy); color: #fff; font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.feed ul { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 12px 0; border-bottom: 1px solid var(--line-soft); font-size: 15px; }
.feed li:last-child { border-bottom: 0; padding-bottom: 0; }

.newsletter { margin: 48px 0 64px; background: var(--navy); color: #fff; border-radius: 12px; padding: 28px 32px; display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; justify-content: space-between; }
.newsletter h2 { font-size: 22px; }
.newsletter p { color: #D5DEEA; }
.newsletter form { display: flex; flex-wrap: wrap; gap: 8px; flex: 0 1 420px; }
.newsletter form[hidden], .nl-done[hidden] { display: none; }
.newsletter input { flex: 1 1 200px; min-width: 0; height: 48px; border: 0; border-radius: 8px; padding: 0 14px; font: inherit; color: var(--ink); }
.newsletter .btn-blue { border: 1.5px solid #fff; }
.nl-done { font-weight: 600; color: #fff !important; }
@media (max-width: 800px) { .news { grid-template-columns: minmax(0, 1fr); } }

section[id], footer[id] { scroll-margin-top: 88px; }

/* notices: filter tabs */
.notice-col { flex: 999 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.notice-col .notices { margin-bottom: 0; }
.notices a[hidden] { display: none; }
.ntabs { display: flex; flex-wrap: wrap; gap: 8px; }
.ntab { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line-strong); background: #fff; color: var(--ink); font: inherit; font-size: 15px; cursor: pointer; }
.ntab:hover { background: var(--tint); }
.ntab[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
