/* ──────────────────────────────────────────────────────────────────────────
   read_news.php — หน้าอ่านข่าว (หน้าสาธารณะ)

   รูปทรง: หน้าข่าวในจดหมายข่าวของโรงเรียน
       กระดาษแผ่นเดียวมีสันสีน้ำเงินซ้าย 12px แบบหน้าสาธารณะชุดเดียวกัน
       หัวข่าวคือหมวด พาดหัวตัวเซริฟ และบรรทัดวันที่ ไม่ใช่แถบไล่เฉดทับภาพ
       ภาพปกขึ้นเต็มตามสัดส่วนจริง เนื้อข่าวอยู่ในคอลัมน์กว้างพอดีอ่าน
       ภาพกิจกรรมเป็นแผ่นพิสูจน์ภาพครบทุกรูป กดแล้วเปิดตัวดูภาพเต็มจอ

   สี: ไม่ประกาศจานสีใหม่ ทุกตัวเป็น alias ที่ชี้ไป --tb1-* ของธีม
       สีแดงสงวนไว้ให้การลบข่าวอย่างเดียว

   ความเฉพาะ: หน้านี้แนบ css/tb1-display-scale.css (ผ่าน nvabar ใน <body> จึงโหลดทีหลังไฟล์นี้)
       - สีลิงก์โหมดมืดของไฟล์กลางมี specificity (0,1,1) กฎสีลิงก์ของหน้าจึงต้องมีคลาสสองชั้น
       - โหมดคอนทราสต์สูงของไฟล์กลางบังคับสีให้ main/section/article/aside และตัวอักษรทุกชนิด
         ด้วย !important หน้านี้เขียนเฉพาะสิ่งที่ไฟล์กลางไม่รู้จัก
       - ขนาดตัวอักษรเป็น rem ทั้งหมด ปุ่มปรับขนาดตัวอักษรของเว็บจึงมีผล
       ธีมบังคับ font-family บน p/span/div/li ด้วย !important ตัวเซริฟจึงอยู่ที่ h1–h3 และ b
   ────────────────────────────────────────────────────────────────────────── */

.nr {
    --nr-paper: var(--tb1-surface, #ffffff);
    --nr-paper-alt: var(--tb1-surface-alt, #f1f5f9);
    --nr-ink: var(--tb1-ink-1, #0f172a);
    --nr-ink-2: var(--tb1-ink-2, #334155);
    --nr-muted: var(--tb1-ink-3, #5a697f);
    --nr-line: var(--tb1-border, #e2e8f0);
    --nr-line-bold: var(--tb1-border-bold, #cbd5e1);
    --nr-brand: var(--tb1-brand, #1d4ed8);
    --nr-spine: var(--tb1-brand-strong, #1e3a8a);
    --nr-wash: var(--tb1-brand-50, #eff6ff);
    --nr-on-brand: var(--tb1-on-brand, #ffffff);
    /* โทเคน text-danger โหมดสว่าง (#DC2626) ได้ 4.41:1 บนพื้นรอง ไม่ผ่าน AA */
    --nr-warn: #b91c1c;
    --nr-on-warn: #ffffff;
    --nr-serif: var(--tb1-font-display, "Noto Serif Thai", serif);
    --nr-sans: var(--tb1-font-body, "Sarabun", system-ui, sans-serif);
    --nr-lift: 0 12px 30px -22px rgba(15, 23, 42, .5);
    --nr-edge: inset 0 1px 0 rgba(255, 255, 255, .6);

    color: var(--nr-ink);
    font-family: var(--nr-sans);
    font-size: 1rem;
    line-height: 1.6;
}

:is(html.dark, html.dark-mode, html[data-theme="dark"],
    body.dark-mode, body[data-theme="dark"]) .nr {
    --nr-warn: var(--tb1-text-danger, #fda4af);
    --nr-on-warn: var(--tb1-page, #0a1120);
    /* brand-strong โหมดมืดเป็นฟ้าอ่อน สันกระดาษจะสว่างกว่าตัวอักษร ใช้พื้นแบนเนอร์แทน */
    --nr-spine: var(--tb1-banner-4, #2563eb);
    --nr-lift: 0 16px 36px -24px rgba(0, 0, 0, .9);
    --nr-edge: inset 0 1px 0 rgba(255, 255, 255, .055);
}

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

.nr :where(h1, h2, h3, h4, p, ol, ul, figure, blockquote) {
    margin: 0;
}

.nr :where(.nr-crumbs ol, .nr-sheet, .nr-recent-list) {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* [hidden] ของ UA stylesheet มี specificity ศูนย์ จึงแพ้ display ที่หน้ากำหนดเอง */
.nr [hidden] {
    display: none !important;
}

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

.nr :focus-visible {
    outline: 3px solid var(--nr-brand);
    outline-offset: 2px;
}

/* ลิงก์ต้องมีคลาสสองชั้น ไม่งั้นแพ้สีลิงก์โหมดมืดของไฟล์กลางที่โหลดทีหลัง */
.nr .nr-link {
    color: var(--nr-brand);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.nr .nr-link:hover {
    text-decoration-thickness: 2px;
}

/* ── เปลือกหน้า ─────────────────────────────────────────────────────────── */
body.nr-page {
    margin: 0;
    background: var(--tb1-page, #f8fafc);
    color: var(--tb1-ink-1, #0f172a);
}

/* แถบเมนูติดขอบบนสูงราว 57px ช่องที่ไล่ Tab ไปถึงหรือที่กระโดดไปต้องไม่จมใต้แถบ */
html:has(body.nr-page) {
    scroll-padding-top: 4.5rem;
}

.nr-shell {
    box-sizing: border-box;
    display: block;
    width: 100%;
    max-width: var(--tb1-page-max-width, 1440px);
    margin-inline: auto;
    padding: 1.5rem var(--tb1-shell-gutter, 20px) 3rem;
}

/* skip link ใช้พื้นแบนเนอร์ซึ่งเข้มทั้งสองโหมด (0,2,1) เพื่อชนะสีลิงก์ของไฟล์กลาง */
body.nr-page a.nr-skip {
    position: absolute;
    top: 8px;
    left: -9999px;
    z-index: 2000;
    padding: 10px 16px;
    color: #ffffff;
    background: var(--tb1-banner-1, #1d4ed8);
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
}

body.nr-page a.nr-skip:focus {
    left: 12px;
    outline: 3px solid var(--tb1-brand-300, #93c5fd);
    outline-offset: 2px;
}

/* ── กระดาษ ─────────────────────────────────────────────────────────────── */
.nr-paper {
    padding: 1.4rem 1.75rem 2rem;
    background: var(--nr-paper);
    border: 1px solid var(--nr-line);
    border-left: 12px solid var(--nr-spine);
    border-radius: 14px;
    box-shadow: var(--nr-lift), var(--nr-edge);
}

.nr-topline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 1rem;
    margin-bottom: 1.1rem;
}

.nr-crumbs ol {
    display: flex;
    flex-wrap: wrap;
    gap: .15rem 0;
    font-size: .88rem;
}

/* ตัวคั่นเป็นเส้นเฉียงบาง ไม่ใช่ตัวอักษร "/" หรือ "·" */
.nr-crumbs li + li::before {
    content: "";
    display: inline-block;
    width: 1px;
    height: .8em;
    margin: 0 .7rem;
    vertical-align: -.05em;
    background: var(--nr-line-bold);
    transform: skewX(-18deg);
}

.nr-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem .5rem;
    margin-top: .9rem;
    padding-top: .9rem;
    border-top: 1px solid var(--nr-line);
}

.nr-tools-label {
    margin-right: .35rem;
    font-size: .88rem;
    font-weight: 600;
    color: var(--nr-muted);
}

/* ลิงก์ที่ไม่ได้อยู่กลางประโยคต้องมีเป้ากดสูงอย่างน้อย 24px (WCAG 2.5.8) */
.nr .nr-crumbs a,
.nr .nr-jump,
.nr .nr-recent-all .nr-link {
    /* inline-block ไม่ใช่ inline-flex เพราะ flex ตัดช่องว่างรอบ <b> ในลิงก์ทิ้ง */
    display: inline-block;
    min-height: 24px;
    padding-block: .1rem;
}

/* ── ปุ่ม ───────────────────────────────────────────────────────────────── */
.nr .nr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0 1rem;
    color: var(--nr-brand);
    background: var(--nr-paper);
    border: 1px solid var(--nr-line-bold);
    border-radius: 8px;
    font: inherit;
    font-size: .92rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .16s ease, transform .16s ease;
}

.nr .nr-btn:hover {
    border-color: var(--nr-brand);
}

.nr .nr-btn:active {
    transform: translateY(1px);
}

.nr .nr-btn-small {
    min-height: 2.1rem;
    padding: 0 .8rem;
    font-size: .86rem;
}

.nr .nr-btn-warn {
    color: var(--nr-warn);
}

.nr .nr-dialog .nr-btn-warn {
    color: var(--nr-on-warn);
    background: var(--nr-warn);
    border-color: var(--nr-warn);
}

.nr .nr-btn[disabled] {
    opacity: .65;
    cursor: progress;
}

/* ── โครงสองคอลัมน์ ────────────────────────────────────────────────────
   DOM เรียงตามลำดับที่อ่านบนจอแคบ: หัวข่าว ตัวข่าว ภาพกิจกรรม ข่าวก่อนหน้าถัดไป ข่าวล่าสุด
   จอกว้างย้าย "ข่าวล่าสุด" ขึ้นไปข้างตัวข่าวด้วย grid-area โดยไม่ต้องวาดสองชุด */
.nr-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
        "mast"
        "actions"
        "main"
        "pager"
        "recent";
    gap: 1.75rem;
}

.nr-mast {
    grid-area: mast;
    min-width: 0;
}

.nr-actions {
    grid-area: actions;
    min-width: 0;
}

.nr-main {
    grid-area: main;
    min-width: 0;
}

.nr-main:focus {
    outline: none;
}

.nr-pager {
    grid-area: pager;
}

.nr-recent {
    grid-area: recent;
    min-width: 0;
}

/* จอกว้าง: พาดหัวอยู่คอลัมน์ซ้ายเต็มความกว้างของตัวข่าว หัวคอลัมน์ขวาคือแชร์และเครื่องมือผู้ดูแล
   ข้างพาดหัวจึงไม่เหลือที่ว่างเปล่า

   สองคอลัมน์ไหลแยกกัน: ตัวข่าว (ภาพปก เนื้อข่าว คลิป ภาพกิจกรรม) คร่อมแถว 2–3 แผงแชร์คร่อมแถว 1–2
   ภาพปกเริ่มทันทีใต้พาดหัว และข่าวล่าสุดเริ่มทันทีใต้แผงแชร์ ไม่ว่าฝั่งไหนจะสูงกว่า
   (แถวที่ 1 สูงเท่าพาดหัวพอดี ความสูงส่วนเกินของแผงแชร์ไหลไปแถวที่ 2)
   row-gap ต้องเป็น 0 ไม่งั้นแถว 2 ที่สูง 0 ทำให้ข่าวล่าสุดต่ำกว่าภาพปกหนึ่งช่องไฟ ระยะห่างใช้ margin แทน

   เส้นแบ่งคอลัมน์วาดด้วย ::before ที่คร่อมสามแถว เส้นจึงต่อเนื่อง */
@media (min-width: 1024px) {
    .nr-grid {
        /* คอลัมน์ขวากว้างขึ้นเป็น 22rem ให้ข่าวล่าสุดเป็นการ์ดภาพใหญ่ พาดหัวไม่ต้องตัดหกบรรทัด */
        grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem);
        grid-template-areas:
            "mast actions"
            "main actions"
            "main recent"
            "pager pager";
        /* แถว 3 เป็น 1fr: grid ข้ามรายการที่คร่อมแถวยืดหยุ่นตอนแจกความสูงส่วนเกิน
           ตัวข่าวที่ยาวจึงยืดแถว 3 ไม่ใช่แถว 2 ข่าวล่าสุดไม่ถูกดันลง */
        grid-template-rows: auto auto 1fr auto;
        column-gap: 2.75rem;
        row-gap: 0;
    }

    .nr-main,
    .nr-recent,
    .nr-pager {
        margin-top: 2rem;
    }

    .nr-main,
    .nr-recent {
        align-self: start;
    }

    .nr-grid::before {
        content: "";
        grid-column: 2;
        grid-row: 1 / 4;
        margin-left: -1.4rem;
        border-left: 1px solid var(--nr-line);
        pointer-events: none;
    }

    .nr-actions,
    .nr-recent {
        padding-left: 1.5rem;
    }

    .nr-actions {
        align-self: start;
        padding-top: .2rem;
    }

    .nr-actions .nr-share {
        padding-top: 0;
        border-top: 0;
    }

    .nr-actions :is(.nr-share-label, .nr-tools-label) {
        flex-basis: 100%;
        margin: 0 0 .1rem;
    }
}

/* ── หัวข่าว ─────────────────────────────────────────────────────────── */
.nr-kicker {
    margin-bottom: .45rem;
    font-size: .9rem;
    font-weight: 700;
}

.nr .nr-kicker-link {
    display: inline-block;
    min-height: 24px;
    color: var(--nr-brand);
    text-decoration: none;
    border-bottom: 2px solid currentColor;
    padding-bottom: 1px;
}

.nr .nr-kicker-link:hover {
    border-bottom-width: 3px;
}

/* ความยาวพาดหัวเฉลี่ยราว 100 ตัวอักษร ขนาดจึงลดตามความยาว (view ใส่ is-long / is-xlong)
   ไม่จำกัด max-width แล้ว คอลัมน์ซ้ายกำหนดความกว้างให้เอง ข้างพาดหัวไม่เหลือที่ว่างเปล่า */
.nr-title {
    font-family: var(--nr-serif);
    font-size: clamp(1.6rem, 1.15rem + 1.9vw, 2.45rem);
    font-weight: 600;
    line-height: 1.38;
    color: var(--nr-ink);
    overflow-wrap: anywhere;
    text-wrap: pretty;
}

.nr-title.is-long {
    font-size: clamp(1.45rem, 1.1rem + 1.3vw, 2.05rem);
    line-height: 1.42;
}

.nr-title.is-xlong {
    font-size: clamp(1.35rem, 1.05rem + 1vw, 1.8rem);
    line-height: 1.45;
}

.nr-dateline {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .2rem 1.35rem;
    margin-top: .8rem;
    font-size: .95rem;
    color: var(--nr-ink-2);
}

.nr-dateline time {
    font-weight: 600;
}

.nr .nr-jump {
    color: var(--nr-brand);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.nr-jump b {
    font-family: var(--nr-serif);
    font-weight: 600;
}

/* ── แชร์ ──────────────────────────────────────────────────────────────── */
/* จอแคบ: แผงแชร์ต่อจากหัวข่าว เส้นบนแยกจากบรรทัดวันที่ ระยะห่างมาจาก gap ของ grid แล้ว */
.nr-share {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem .5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--nr-line);
}

.nr-share-label {
    margin-right: .35rem;
    font-size: .88rem;
    font-weight: 600;
    color: var(--nr-muted);
}

.nr .nr-share-btn {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-height: 2.25rem;
    padding: 0 .8rem;
    color: var(--nr-ink-2);
    background: var(--nr-paper);
    border: 1px solid var(--nr-line-bold);
    border-radius: 999px;
    font: inherit;
    font-size: .86rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .16s ease, color .16s ease;
}

.nr .nr-share-btn:hover {
    color: var(--nr-brand);
    border-color: var(--nr-brand);
}

.nr-share-btn i {
    font-size: .95em;
}

.nr .nr-share-btn.is-done {
    color: var(--nr-brand);
    border-color: var(--nr-brand);
}

/* ── ภาพปก ─────────────────────────────────────────────────────────────
   ขึ้นตามสัดส่วนจริงของภาพ ภาพแนวตั้งไม่ยืดจนเต็มจอ ไม่ตัดขอบ ไม่ทับด้วยไล่เฉด */
.nr-lead {
    margin-bottom: 1.6rem;
    border-radius: 10px;
    background: var(--nr-paper-alt);
    overflow: hidden;
    text-align: center;
}

.nr-lead img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: min(78vh, 46rem);
    margin-inline: auto;
}

/* ภาพแนวนอนเต็มคอลัมน์ ขอบซ้ายขวาตรงกับพาดหัวและเนื้อข่าว ไม่มีแถบเทาบาง ๆ สองข้าง */
.nr-lead.is-wide {
    background: none;
}

.nr-lead.is-wide img {
    width: 100%;
    max-height: none;
}

/* ── เนื้อข่าว ─────────────────────────────────────────────────────────── */
/* เนื้อข่าวกว้างเท่าภาพปก ขอบขวาตรงกัน (ผอ. ขอ) จอกว้างขยายตัวอักษรขึ้นเล็กน้อยให้บรรทัดยาวยังอ่านสบาย */
.nr-body {
    font-size: 1.1rem;
    line-height: 1.9;
    color: var(--nr-ink);
    overflow-wrap: anywhere;
}

.nr-body::after {
    content: "";
    display: block;
    clear: both;
}

.nr-body :where(p, ul, ol, blockquote, figure, .nr-table, hr) {
    margin-block: 0 1.05em;
}

.nr-body > :last-child {
    margin-bottom: 0;
}

.nr-body :where(h2, h3, h4, h5, h6) {
    margin: 1.6em 0 .5em;
    font-family: var(--nr-serif);
    font-weight: 600;
    line-height: 1.4;
    color: var(--nr-ink);
}

.nr-body h2 {
    font-size: 1.4rem;
}

.nr-body h3 {
    font-size: 1.22rem;
}

.nr-body :where(h4, h5, h6) {
    font-size: 1.08rem;
}

.nr-body :where(ul, ol) {
    padding-left: 1.5rem;
}

.nr-body ul {
    list-style: disc;
}

.nr-body ol {
    list-style: decimal;
}

.nr-body li + li {
    margin-top: .3em;
}

.nr .nr-body a:not(.nr-embed) {
    color: var(--nr-brand);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.nr .nr-body a:not(.nr-embed):hover {
    text-decoration-thickness: 2px;
}

.nr-body :where(strong, b) {
    font-weight: 700;
    color: var(--nr-ink);
}

.nr-body blockquote {
    padding: .2rem 0 .2rem 1.1rem;
    border-left: 3px solid var(--nr-spine);
    color: var(--nr-ink-2);
}

.nr-body hr {
    border: 0;
    border-top: 1px solid var(--nr-line);
}

.nr-body img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* รูปในเนื้อข่าวจาก CKEditor (ลอยซ้าย ลอยขวา ย่อขนาด) ย้ายมาจาก read-news.css เดิม */
.nr-body figure.image {
    display: table;
    max-width: 100%;
    margin: 1.4rem auto;
    text-align: center;
}

.nr-body figure.image img {
    margin: 0 auto;
}

.nr-body figure.image[style*="width"] img,
.nr-body figure.image_resized img {
    width: 100% !important;
    height: auto !important;
}

.nr-body figure.image-style-side:not([style*="width"]),
.nr-body figure.image-style-wrapText:not([style*="width"]),
.nr-body figure.image-style-align-left:not([style*="width"]),
.nr-body figure.image-style-align-right:not([style*="width"]),
.nr-body figure.image-style-block-align-left:not([style*="width"]),
.nr-body figure.image-style-block-align-right:not([style*="width"]),
.nr-body figure.image-style-align-block-left:not([style*="width"]),
.nr-body figure.image-style-align-block-right:not([style*="width"]) {
    width: min(52%, 560px);
}

.nr-body figure.image-style-align-center:not([style*="width"]),
.nr-body figure.image-style-breakText:not([style*="width"]) {
    width: 100%;
}

.nr-body figure.image-style-align-left,
.nr-body figure.image-style-wrapText,
.nr-body figure.image-style-block-align-left,
.nr-body figure.image-style-align-block-left {
    float: left;
    margin: .35rem 1.35rem 1rem 0;
}

.nr-body figure.image-style-align-right,
.nr-body figure.image-style-side,
.nr-body figure.image-style-block-align-right,
.nr-body figure.image-style-align-block-right {
    float: right;
    margin: .35rem 0 1rem 1.35rem;
}

.nr-body figure.image-style-align-center {
    margin-inline: auto;
}

.nr-body figcaption {
    margin-top: .5rem;
    font-size: .88rem;
    line-height: 1.55;
    color: var(--nr-muted);
    text-align: center;
}

/* ตารางกว้างเลื่อนในกล่องของตัวเอง */
.nr-body .nr-table {
    position: relative;
    max-width: 100%;
    overflow-x: auto;
}

.nr-body table {
    width: 100%;
    /* ตารางไม่บีบคอลัมน์จนตัดคำทีละพยางค์บนมือถือ ให้เลื่อนในกล่องแทน */
    min-width: 30rem;
    border-collapse: collapse;
    font-size: .95rem;
    line-height: 1.6;
}

.nr-body :where(th, td) {
    padding: .5rem .7rem;
    border: 1px solid var(--nr-line-bold);
    text-align: left;
    vertical-align: top;
}

.nr-body th {
    background: var(--nr-paper-alt);
    font-weight: 700;
}

.nr-body :where(th, td) > :where(p, ul, ol):last-child {
    margin-bottom: 0;
}

.nr-body :where(th, td) > :where(p, ul, ol) {
    margin-bottom: .5em;
}

/* โค้ดฝังที่แปลงเป็นลิงก์ (โพสต์ Facebook แผนที่ Google) */
.nr .nr-embed {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    max-width: 30rem;
    padding: .75rem 1rem;
    color: var(--nr-ink);
    background: var(--nr-paper-alt);
    border: 1px solid var(--nr-line);
    border-left: 3px solid var(--nr-brand);
    border-radius: 0 8px 8px 0;
    text-decoration: none;
    line-height: 1.5;
}

.nr-body > .nr-embed {
    margin-bottom: 1.05em;
}

.nr-embed-kind {
    font-size: .86rem;
    color: var(--nr-muted);
}

.nr .nr-embed-cta {
    font-weight: 700;
    color: var(--nr-brand);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.nr .nr-embed:hover .nr-embed-cta {
    text-decoration-thickness: 2px;
}

.nr-body .nr-video {
    display: block;
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background: #000000;
}

.nr-body .nr-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ── หัวข้อส่วนย่อย ─────────────────────────────────────────────────── */
.nr-section-title {
    font-family: var(--nr-serif);
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.4;
}

.nr-section-note {
    font-size: .92rem;
    color: var(--nr-muted);
}

.nr-section-note b {
    font-family: var(--nr-serif);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--nr-ink);
}

/* ── คลิปกิจกรรม ───────────────────────────────────────────────────────── */
.nr-reel {
    margin-top: 2rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--nr-line);
    scroll-margin-top: 4.5rem;
}

.nr-reel-video {
    display: block;
    width: min(100%, 18rem);
    aspect-ratio: 9 / 16;
    margin-top: .8rem;
    object-fit: cover;
    background: #000000;
    border-radius: 10px;
}

/* ── แผ่นภาพกิจกรรม ────────────────────────────────────────────────────
   ภาพย่อสี่เหลี่ยมจัตุรัสเรียงตามลำดับ กวาดตาหาคนในภาพได้เร็ว ภาพเต็มอยู่หลังการกด */
.nr-album {
    margin-top: 2rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--nr-line);
    scroll-margin-top: 4.5rem;
}

.nr-album-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .25rem 1rem;
    margin-bottom: .9rem;
}

.nr-sheet {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(8.5rem, 100%), 1fr));
    gap: .45rem;
}

.nr .nr-shot {
    position: relative;
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 6px;
    background: var(--nr-paper-alt);
}

.nr-shot img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .2s ease;
}

.nr .nr-shot:hover img {
    transform: scale(1.03);
}

.nr .nr-shot:focus-visible {
    outline-offset: 2px;
}

.nr-print-note {
    display: none;
}

/* ── ข่าวก่อนหน้า ข่าวถัดไป ────────────────────────────────────────────── */
.nr-pager {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--nr-line);
}

.nr .nr-pager-link {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    padding: .65rem .9rem;
    color: var(--nr-ink);
    border: 1px solid var(--nr-line);
    border-left: 3px solid var(--nr-line-bold);
    border-radius: 0 8px 8px 0;
    text-decoration: none;
    transition: border-color .16s ease;
}

.nr .nr-pager-link.is-newer {
    grid-column: 2;
    text-align: right;
    border-left: 1px solid var(--nr-line);
    border-right: 3px solid var(--nr-line-bold);
    border-radius: 8px 0 0 8px;
}

.nr .nr-pager-link:hover {
    border-left-color: var(--nr-brand);
}

.nr .nr-pager-link.is-newer:hover {
    border-left-color: var(--nr-line);
    border-right-color: var(--nr-brand);
}

.nr-pager-label {
    font-size: .84rem;
    font-weight: 600;
    color: var(--nr-muted);
}

.nr .nr-pager-title {
    font-weight: 600;
    line-height: 1.5;
    color: var(--nr-brand);
    overflow-wrap: anywhere;
}

/* ── ข่าวล่าสุด ────────────────────────────────────────────────────────── */
.nr-side-title {
    margin-bottom: .6rem;
    font-family: var(--nr-serif);
    font-size: 1.12rem;
    font-weight: 600;
}

/* จอแคบ: รายการแนวนอน ภาพ 4:3 กว้าง 6.5rem (เดิมสี่เหลี่ยม 4.5rem เล็กจนดูไม่ออก) */
.nr-recent-item + .nr-recent-item {
    border-top: 1px solid var(--nr-line);
}

.nr .nr-recent-link {
    display: grid;
    grid-template-columns: 6.5rem minmax(0, 1fr);
    gap: .85rem;
    align-items: start;
    padding: .8rem 0;
    color: var(--nr-ink);
    text-decoration: none;
}

.nr-recent-img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 6px;
    background: var(--nr-paper-alt);
}

.nr-recent-text {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    min-width: 0;
}

.nr-recent-title {
    font-size: .95rem;
    font-weight: 600;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.nr .nr-recent-link:hover .nr-recent-title {
    color: var(--nr-brand);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.nr .nr-recent-link:hover .nr-recent-img {
    filter: brightness(1.06);
}

.nr-recent-date {
    font-size: .82rem;
    color: var(--nr-muted);
}

.nr-recent-all {
    margin-top: .9rem;
    font-size: .92rem;
}

/* จอกลางขึ้นไป: การ์ดภาพบนชื่อข่าวล่าง ภาพกว้างเต็มการ์ด
   ท้ายหน้า (จอกลาง / หน้าไม่พบข่าว) เรียงหลายคอลัมน์ คอลัมน์ขวาของจอกว้างเรียงคอลัมน์เดียว */
@media (min-width: 640px) {
    .nr-recent-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(min(14rem, 100%), 1fr));
        gap: 1.4rem 1.25rem;
    }

    .nr-recent-item + .nr-recent-item {
        border-top: 0;
    }

    .nr .nr-recent-link {
        grid-template-columns: minmax(0, 1fr);
        gap: .55rem;
        padding: 0;
    }

    .nr-recent-img {
        aspect-ratio: 16 / 10;
        border-radius: 8px;
    }

    .nr-recent-title {
        font-size: .98rem;
    }
}

@media (min-width: 1024px) {
    .nr-recent:not(.nr-recent-wide) {
        align-self: start;
    }

    .nr-recent:not(.nr-recent-wide) .nr-recent-list {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.5rem;
    }

    .nr-recent.nr-recent-wide {
        padding-left: 0;
        border-left: 0;
    }

    /* หน้าไม่พบข่าว: ข่าวล่าสุด 6 เรื่องเป็นสองแถวแถวละสาม ไม่เหลือการ์ดเดียวค้างแถวล่าง */
    .nr-recent-wide .nr-recent-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .nr-body {
        font-size: 1.16rem;
    }
}

/* ── ไม่พบข่าว ─────────────────────────────────────────────────────────── */
.nr-missing .nr-title {
    margin-top: .4rem;
}

.nr-missing .nr-title:focus {
    outline: none;
}

.nr-missing-text {
    max-width: 40rem;
    margin: .6rem 0 1.6rem;
    color: var(--nr-ink-2);
}

/* ── ตัวดูภาพเต็มจอ ────────────────────────────────────────────────────
   พื้นมืดทุกโหมด เพราะเป็นที่ดูภาพ ภาพเลื่อนด้วย scroll-snap ของเบราว์เซอร์
   นิ้วปัดบนมือถือจึงลื่นตามระบบ และคีย์บอร์ดกับปุ่มใช้ทางเดียวกัน */
.nr-viewer {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    padding: 0;
    border: 0;
    color: #f1f5f9;
    background: #070b14;
    overflow: hidden;
}

.nr-viewer[open] {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.nr-viewer::backdrop {
    background: #070b14;
}

.nr-viewer-bar,
.nr-viewer-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .75rem;
    padding: .6rem max(1rem, env(safe-area-inset-left)) .6rem max(1rem, env(safe-area-inset-right));
}

.nr-viewer-bar {
    padding-top: max(.6rem, env(safe-area-inset-top));
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.nr-viewer-nav {
    justify-content: center;
    padding-bottom: max(.7rem, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, .12);
}

.nr-viewer-title {
    font-family: var(--nr-serif);
    font-size: 1rem;
    font-weight: 600;
    color: #f8fafc;
}

.nr-viewer-count {
    margin-right: auto;
    font-size: .92rem;
    color: #cbd5e1;
    font-variant-numeric: tabular-nums;
}

.nr-viewer-count b {
    color: #ffffff;
}

.nr .nr-viewer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0 1rem;
    color: #f8fafc;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 8px;
    font: inherit;
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.nr .nr-viewer-btn:hover {
    background: rgba(255, 255, 255, .16);
    border-color: rgba(255, 255, 255, .5);
}

.nr .nr-viewer-btn[disabled] {
    opacity: .4;
    cursor: default;
}

.nr .nr-viewer-step {
    min-width: 8.5rem;
}

.nr-viewer :focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 2px;
}

.nr-viewer-track {
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior: contain;
    scrollbar-width: none;
}

.nr-viewer-track::-webkit-scrollbar {
    display: none;
}

.nr-viewer-slide {
    display: grid;
    /* แถวต้องเป็น 1fr ที่มีความสูงแน่นอน max-height:100% ของภาพจึงมีผล
       ถ้าเป็นแถว auto ภาพแนวตั้งจะสูงเกินจอแล้วถูกตัดท้าย */
    grid-template-rows: minmax(0, 1fr);
    grid-template-columns: minmax(0, 1fr);
    place-items: center;
    flex: 0 0 100%;
    height: 100%;
    min-width: 0;
    padding: .75rem;
    scroll-snap-align: center;
    scroll-snap-stop: always;
}

.nr-viewer-slide img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    user-select: none;
    -webkit-user-select: none;
}

html.nr-viewer-open {
    overflow: hidden;
}

/* ── หน้าต่างยืนยันการลบ ───────────────────────────────────────────────── */
.nr-dialog {
    width: min(30rem, calc(100vw - 32px));
    padding: 1.4rem 1.4rem 1.1rem;
    color: var(--nr-ink);
    background: var(--nr-paper);
    border: 1px solid var(--nr-line-bold);
    border-radius: 14px;
    box-shadow: 0 24px 60px -24px rgba(15, 23, 42, .55);
}

.nr-dialog::backdrop {
    background: rgba(15, 23, 42, .5);
}

.nr-dialog-title {
    font-family: var(--nr-serif);
    font-size: 1.15rem;
    font-weight: 600;
}

.nr-dialog-what {
    margin-top: .7rem;
    padding: .5rem 0 .5rem .8rem;
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--nr-warn);
    overflow-wrap: anywhere;
}

.nr-dialog-note {
    margin-top: .6rem;
    font-size: .92rem;
    color: var(--nr-ink-2);
}

.nr-dialog-error {
    margin-top: .7rem;
    font-size: .92rem;
    font-weight: 600;
    color: var(--nr-warn);
}

.nr-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .5rem;
    margin-top: 1.1rem;
}

/* ── จอแคบ ─────────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
    .nr-shell {
        padding: .9rem 12px 2rem;
    }

    .nr-paper {
        padding: 1rem .95rem 1.4rem;
        border-left-width: 8px;
        border-radius: 12px;
    }

    .nr-grid {
        gap: 1.4rem;
    }

    .nr-body {
        font-size: 1.05rem;
        line-height: 1.85;
    }

    .nr-body figure.image,
    .nr-body figure.image-style-align-left,
    .nr-body figure.image-style-align-right,
    .nr-body figure.image-style-side,
    .nr-body figure.image-style-wrapText,
    .nr-body figure.image-style-breakText,
    .nr-body figure.image-style-block-align-left,
    .nr-body figure.image-style-block-align-right,
    .nr-body figure.image-style-align-block-left,
    .nr-body figure.image-style-align-block-right {
        float: none;
        width: 100% !important;
        margin: 1.1rem auto;
    }

    .nr-lead {
        margin-inline: -.95rem;
        margin-bottom: 1.2rem;
        border-radius: 0;
    }

    /* จอแคบใช้สี่คอลัมน์ ภาพ 85 รูปยังกวาดดูจบได้ในไม่กี่หน้าจอ */
    .nr-sheet {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 3px;
    }

    .nr .nr-shot {
        border-radius: 3px;
    }

    .nr-pager {
        grid-template-columns: minmax(0, 1fr);
    }

    .nr .nr-pager-link.is-newer {
        grid-column: auto;
    }

    .nr-share-label {
        flex-basis: 100%;
    }

    .nr .nr-viewer-step {
        flex: 1 1 0;
        min-width: 0;
    }
}

@media (max-width: 340px) {
    .nr-sheet {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ── โหมดคอนทราสต์สูง ──────────────────────────────────────────────────
   ไฟล์กลางบังคับพื้นดำและตัวอักษรขาวให้ main/section/article/aside และตัวอักษรส่วนใหญ่แล้ว
   ที่นี่เขียนเฉพาะสิ่งที่ไฟล์กลางไม่รู้จัก และให้สิ่งที่แยกด้วยสีมีรูปทรงรองรับ */
html.tb1-contrast-high body.nr-page {
    background: #000000;
    color: #ffffff;
}

html.tb1-contrast-high .nr {
    --nr-lift: none;
    --nr-edge: none;
}

html.tb1-contrast-high .nr-paper,
html.tb1-contrast-high .nr-dialog,
html.tb1-contrast-high .nr-lead,
html.tb1-contrast-high .nr .nr-shot,
html.tb1-contrast-high .nr-recent-img,
html.tb1-contrast-high .nr .nr-embed,
html.tb1-contrast-high .nr-body th {
    background: #000000;
    box-shadow: none;
}

html.tb1-contrast-high .nr-paper {
    border-color: #facc15;
    border-left-color: #facc15;
}

html.tb1-contrast-high .nr-share,
html.tb1-contrast-high .nr-tools,
html.tb1-contrast-high .nr-grid::before,
html.tb1-contrast-high .nr-reel,
html.tb1-contrast-high .nr-album,
html.tb1-contrast-high .nr-pager,
html.tb1-contrast-high .nr-recent,
html.tb1-contrast-high .nr-recent-item,
html.tb1-contrast-high .nr .nr-pager-link,
html.tb1-contrast-high .nr .nr-embed,
html.tb1-contrast-high .nr-body :where(th, td),
html.tb1-contrast-high .nr-dialog {
    border-color: #facc15;
}

html.tb1-contrast-high .nr :where(time, b, figcaption, .nr-embed-kind),
html.tb1-contrast-high .nr-dialog-error {
    color: #ffffff;
}

html.tb1-contrast-high .nr .nr-btn,
html.tb1-contrast-high .nr .nr-share-btn,
html.tb1-contrast-high .nr .nr-link,
html.tb1-contrast-high .nr .nr-jump,
html.tb1-contrast-high .nr .nr-kicker-link {
    color: #facc15;
    background: #000000;
    border-color: #facc15;
}

/* ปุ่มลบในหน้าต่างยืนยันกลับสีเป็นดำบนเหลือง
   ★ ไฟล์กลางบังคับปุ่มทุกตัวด้วย !important ถ้าไม่ !important ด้วยจะเหมือนปุ่มธรรมดา */
html.tb1-contrast-high .nr .nr-dialog .nr-btn-warn {
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
    background: #facc15 !important;
    border-color: #facc15 !important;
}

html.tb1-contrast-high .nr-dialog-what {
    box-shadow: inset 3px 0 0 #facc15;
}

html.tb1-contrast-high .nr-dialog-error {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

html.tb1-contrast-high .nr-body blockquote {
    border-left-color: #facc15;
}

html.tb1-contrast-high .nr :focus-visible,
html.tb1-contrast-high .nr-viewer :focus-visible {
    outline-color: #ffffff;
}

html.tb1-contrast-high .nr-crumbs li + li::before {
    background: #facc15;
}

/* ตัวดูภาพ: พื้นดำ ปุ่มขอบเหลือง */
html.tb1-contrast-high .nr-viewer,
html.tb1-contrast-high .nr-viewer::backdrop {
    background: #000000;
}

html.tb1-contrast-high .nr-viewer-bar,
html.tb1-contrast-high .nr-viewer-nav {
    border-color: #facc15;
}

html.tb1-contrast-high .nr .nr-viewer-btn {
    color: #facc15;
    background: #000000;
    border: 2px solid #facc15;
}

html.tb1-contrast-high body.nr-page a.nr-skip {
    color: #000000;
    background: #facc15;
}

/* ── ฉบับพิมพ์: พิมพ์เป็นหน้าข่าว ภาพกิจกรรม 12 รูปแรก ─────────────────── */
@media print {
    body.nr-page {
        background: #ffffff;
    }

    .nr-shell {
        max-width: none;
        padding: 0;
    }

    .nr-paper {
        padding: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        color: #000000;
        background: #ffffff;
    }

    .nr-topline,
    .nr-actions,
    .nr-share,
    .nr-pager,
    .nr-recent,
    .nr-viewer,
    .nr-dialog,
    .nr-skip,
    .nr-reel {
        display: none !important;
    }

    .nr-grid {
        display: block;
    }

    .nr-grid > * + * {
        margin-top: 1rem;
    }

    .nr-lead {
        background: none;
    }

    .nr-lead img,
    .nr-lead.is-wide img {
        width: auto;
        max-height: 11cm;
    }

    .nr .nr-jump,
    .nr .nr-kicker-link,
    .nr .nr-body a {
        color: #000000;
    }

    .nr-sheet {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .nr-sheet li:nth-child(n + 13) {
        display: none;
    }

    .nr-sheet li {
        break-inside: avoid;
    }

    .nr-album-hint {
        display: none !important;
    }

    .nr-print-note {
        display: block;
        margin-top: .5rem;
        font-size: .9rem;
    }

    .nr-title,
    .nr-section-title {
        break-after: avoid;
    }
}

/* ── ลดการเคลื่อนไหว ───────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .nr *,
    .nr *::before,
    .nr *::after {
        animation: none !important;
        transition: none !important;
    }

    .nr .nr-shot:hover img,
    .nr .nr-btn:active {
        transform: none;
    }

    .nr-viewer-track {
        scroll-behavior: auto;
    }
}
