/* dmf.ac.th public site — single stylesheet, no external font or script dependency
   so the page renders fully under the site CSP (default-src 'self'). */

:root {
    --brand: #0f3a5f;
    --brand-light: #2b6f8f;
    --accent: #c8a24a;
    --ink: #1d2733;
    --ink-muted: #5c6b7d;
    --line: #dce4ed;
    --surface: #ffffff;
    --ground: #f4f7fa;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(19, 35, 51, .08);
}

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

body {
    margin: 0;
    background: var(--ground);
    color: var(--ink);
    font-family: "Sarabun", "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
    font-size: 16px;
    line-height: 1.7;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand-light); }
h1, h2, h3 { line-height: 1.35; }

.container { width: min(1180px, 100% - 32px); margin-inline: auto; }

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

.skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 100;
    background: var(--brand); color: #fff; padding: 10px 16px;
}
.skip-link:focus { left: 0; }

/* Header ------------------------------------------------------------------ */

.site-header { background: var(--surface); border-bottom: 3px solid var(--brand); }

.header-bar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 20px; padding: 16px 0; flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
/* Sized by min-width rather than a fixed width: a school abbreviation set in
   site settings may be several characters, not a single initial. */
.brand-mark {
    min-width: 48px; height: 48px; flex: none; padding: 0 12px;
    display: grid; place-items: center;
    background: var(--brand); color: #fff;
    border-radius: 24px; font-size: 20px; font-weight: 700; white-space: nowrap;
}
.brand-text strong { display: block; font-size: 20px; color: var(--brand); }
.brand-text small { color: var(--ink-muted); }

.search-form { display: flex; gap: 8px; }
.search-form input {
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 9px 12px; font: inherit; min-width: 220px; background: #fff;
}
.search-form button {
    border: 0; border-radius: var(--radius); background: var(--brand-light);
    color: #fff; padding: 9px 18px; font: inherit; font-weight: 700; cursor: pointer;
}
.search-form.standalone { margin-bottom: 24px; }

.site-nav { background: var(--brand); }
.site-nav ul { display: flex; flex-wrap: wrap; gap: 2px; list-style: none; margin: 0; padding: 0; }
.site-nav a {
    display: block; padding: 13px 16px; color: #e8f1f7;
    text-decoration: none; font-weight: 600;
}
.site-nav a:hover, .site-nav a:focus { background: var(--brand-light); color: #fff; }
.site-nav a[aria-current="page"] { background: var(--brand-light); color: #fff; box-shadow: inset 0 -3px 0 var(--accent); }

/* Layout blocks ----------------------------------------------------------- */

main { padding: 28px 0 48px; }

.hero {
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    color: #fff; border-radius: var(--radius); padding: 44px 32px; margin-bottom: 28px;
}
.hero h1 { margin: 0 0 8px; font-size: 30px; }
.hero p { margin: 0; opacity: .92; }

.page-head { margin-bottom: 24px; }
.page-head h1 { margin: 0 0 6px; font-size: 28px; color: var(--brand); }
.page-head p { margin: 0; color: var(--ink-muted); }
.page-head.center { text-align: center; padding: 48px 0; }
.status-code { font-size: 56px; font-weight: 700; color: var(--line); margin: 0; }

.breadcrumb { margin-bottom: 16px; color: var(--ink-muted); font-size: 14px; }
.breadcrumb a { color: var(--brand-light); }

.section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 22px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--line); padding-bottom: 10px; margin-bottom: 16px; }
.section-head h2 { margin: 0; font-size: 20px; color: var(--brand); }
.more-link { font-size: 14px; text-decoration: none; font-weight: 600; }

.home-grid { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.sidebar .section { margin-bottom: 22px; }

.empty { color: var(--ink-muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; }
.muted { color: var(--ink-muted); }

/* Cards ------------------------------------------------------------------- */

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.card-media { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--ground); }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 16px; display: grid; gap: 8px; }
.card-body time { color: var(--ink-muted); font-size: 13px; }
.card-body h2, .card-body h3 { margin: 0; font-size: 17px; }
.card-body h2 a, .card-body h3 a { color: var(--ink); text-decoration: none; }
.card-body h2 a:hover, .card-body h3 a:hover { color: var(--brand-light); text-decoration: underline; }
.card-body p { margin: 0; color: var(--ink-muted); font-size: 14px; }

.banners { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 26px; }
.banner { margin: 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.banner img { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; }
.banner figcaption { padding: 12px 16px; font-weight: 600; }

/* Lists ------------------------------------------------------------------- */

.notice-list, .link-list, .plain-list, .record-list { list-style: none; margin: 0; padding: 0; }
.notice-list li { padding: 12px 0; border-bottom: 1px dashed var(--line); display: grid; gap: 4px; }
.notice-list li:last-child { border-bottom: 0; }
.notice-list a { color: var(--ink); text-decoration: none; font-weight: 600; }
.notice-list a:hover { color: var(--brand-light); text-decoration: underline; }
.notice-list time { font-size: 13px; color: var(--ink-muted); }

.link-list li { padding: 9px 0; border-bottom: 1px dashed var(--line); }
.link-list li:last-child { border-bottom: 0; }

.record-list li {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px;
    display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.record-list h2 { margin: 4px 0 6px; font-size: 18px; }
.record-list h2 a { color: var(--ink); text-decoration: none; }
.record-list h2 a:hover { color: var(--brand-light); text-decoration: underline; }
.record-list p { margin: 0 0 6px; color: var(--ink-muted); font-size: 14px; }
.record-list time { font-size: 13px; color: var(--ink-muted); }
.tag { display: inline-block; background: #e7f1f6; color: var(--brand); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; }

/* Article ----------------------------------------------------------------- */

.article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.article header { border-bottom: 2px solid var(--line); padding-bottom: 14px; margin-bottom: 20px; }
.article h1 { margin: 0 0 8px; font-size: 26px; color: var(--brand); }
.article header time { color: var(--ink-muted); font-size: 14px; }
.article-media { margin: 0 0 22px; }
.article-media img { border-radius: var(--radius); width: 100%; }

.prose { font-size: 17px; }
.prose p { margin: 0 0 1em; }
.prose h2 { font-size: 21px; color: var(--brand); margin: 1.6em 0 .5em; }
.prose h3 { font-size: 18px; margin: 1.4em 0 .5em; }
.prose ul, .prose ol { padding-left: 1.5em; margin: 0 0 1em; }
.prose li { margin-bottom: .35em; }
.prose blockquote { margin: 0 0 1em; padding: 12px 18px; border-left: 4px solid var(--accent); background: var(--ground); }
.attachment { margin-top: 24px; }
.back { margin-top: 22px; }
.back a { text-decoration: none; font-weight: 600; }

/* Personnel and galleries -------------------------------------------------- */

.person-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.person { text-align: center; padding: 18px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--ground); }
.person img, .person-initial { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; margin: 0 auto 12px; }
.person-initial { display: grid; place-items: center; background: var(--brand-light); color: #fff; font-size: 32px; font-weight: 700; }
.person h3 { margin: 0 0 4px; font-size: 16px; }
.person .position { margin: 0; color: var(--brand-light); font-size: 14px; font-weight: 600; }
.person .contact { margin: 4px 0 0; color: var(--ink-muted); font-size: 13px; word-break: break-word; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.photo-grid figure { margin: 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo-grid figcaption { padding: 10px 12px; font-size: 14px; color: var(--ink-muted); }

.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; align-items: start; }
.contact-list { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; }
.contact-list dt { font-weight: 700; color: var(--brand); }
.contact-list dd { margin: 0; }

/* Tables, buttons, pagination --------------------------------------------- */

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.data-table { width: 100%; border-collapse: collapse; min-width: 520px; }
.data-table th, .data-table td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.data-table th { background: var(--ground); color: var(--brand); font-size: 14px; }
.data-table tr:last-child td { border-bottom: 0; }

.button {
    display: inline-block; border: 0; border-radius: var(--radius);
    background: var(--brand-light); color: #fff; padding: 10px 18px;
    font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.button:hover { background: var(--brand); }
.button.compact { padding: 6px 12px; font-size: 14px; }

.pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 28px; }
.pagination a, .pagination span {
    min-width: 40px; text-align: center; padding: 8px 12px;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); text-decoration: none;
}
.pagination span[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }

/* Footer ------------------------------------------------------------------ */

.site-footer { background: var(--brand); color: #d9e6f0; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 28px; padding: 36px 0 24px; }
.footer-grid h2 { font-size: 16px; color: #fff; margin: 0 0 12px; }
.footer-grid p { margin: 0 0 6px; font-size: 14px; }
.footer-grid a { color: #d9e6f0; text-decoration: none; font-size: 14px; }
.footer-grid a:hover { color: #fff; text-decoration: underline; }
.footer-grid .plain-list li { padding: 4px 0; }
.footer-note { border-top: 1px solid rgba(255, 255, 255, .18); padding: 16px 0; font-size: 13px; }
.footer-note p { margin: 0; }

/* Responsive -------------------------------------------------------------- */

@media (max-width: 900px) {
    .home-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .header-bar { flex-direction: column; align-items: stretch; }
    .search-form input { min-width: 0; flex: 1; }
    .site-nav ul { flex-direction: column; }
    .site-nav a { border-bottom: 1px solid rgba(255, 255, 255, .12); }
    .article { padding: 20px; }
    .record-list li { flex-direction: column; align-items: stretch; }
}

@media print {
    .site-nav, .search-form, .site-footer, .pagination, .back { display: none; }
    body { background: #fff; }
    .article { border: 0; box-shadow: none; padding: 0; }
}
