/* ==========================================================================
   หน้ารายละเอียดข่าว (/news/{id}) - frontend/news/show + news/detail/*
   --------------------------------------------------------------------------
   โหลดต่อจาก news.css (ตัวแปร --nw-* ป้าย .nw-badge รูป .nw-thumb สถิติ .nw-stats เนื้อหา .nw-prose
   กล่องแชร์ .nw-sharebox / .nw-qr)
   สเกลเดียวกับหน้าข่าวสารทั้งหมด/belib: เนื้อหาอยู่ใน .container (กว้างสุด 1320px) ขนาดเป็น px
   ========================================================================== */

.nd-page {
    padding-top: 40px;
}

/* เนื้อหา | คอลัมน์ข้าง (ไม่มีข่าวยอดนิยม = เนื้อหาเต็มแถว) */
.nd-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 40px;
}
.nd-layout.has-aside { grid-template-columns: minmax(0, 1fr) 380px; }
.nd-article { min-width: 0; }

/* ── หัวข่าว (news/detail/_head) ─────────────────────────────────────── */
.nd-head {
    display: grid;
    grid-template-columns: minmax(0, .82fr) minmax(0, 1fr);
    align-items: start;
    gap: 28px;
}
.nd-head.no-cover { grid-template-columns: minmax(0, 1fr); }
.nd-cover {
    margin: 0;
    aspect-ratio: 1;
    border-radius: 14px;
}
.nd-head-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}
.nd-cat {
    padding: 2px 10px;
    font-size: 13px;
}
.nd-stats { margin-top: 10px; }
.nd-title {
    margin: 14px 0 12px;
    color: var(--nw-navy-deep);
    font-family: var(--bs-font-primary);
    font-weight: 600;
    font-size: 28px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.nd-lead {
    margin: 0 0 20px;
    color: var(--nw-text);
    font-size: 15px;
    line-height: 1.75;
}
.nd-share { margin-top: 4px; }

/* ── เนื้อหา (news/detail/_content) ─────────────────────────────────────
   รูปในเนื้อหาเต็มคอลัมน์ มุมมนตามแบบ */
.nd-content {
    margin-top: 36px;
    font-size: 16px;
    line-height: 1.85;
}
.nd-content img { display: block; margin: 28px 0; border-radius: 12px; }
.nd-empty { color: var(--nw-muted); }

.nd-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--nw-line);
    font-size: 14px;
}
.nd-tags-label { color: var(--nw-muted); }
.nd-tag {
    padding: 3px 12px;
    border-radius: 50rem;
    background: var(--nw-navy-soft);
    color: var(--nw-navy);
    text-decoration: none;
}
.nd-tag:hover { background: var(--nw-navy); color: #fff; }

/* ── ข่าวสารยอดนิยม (news/detail/_popular) ───────────────────────────── */
.nd-aside { min-width: 0; }
.nd-aside-title {
    margin: 0 0 20px;
    color: var(--nw-navy-deep);
    font-family: var(--bs-font-primary);
    font-weight: 600;
    font-size: 24px;
    line-height: 1.35;
}
.nd-popular {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.nd-pop {
    position: relative;
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    align-items: start;
    gap: 14px;
}
.nd-pop-media {
    aspect-ratio: 1;
    border-radius: 8px;
}
.nd-pop-media img { transition: transform .35s ease; }
.nd-pop:hover .nd-pop-media img { transform: scale(1.05); }
.nd-pop-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}
.nd-pop-body .nd-cat {
    padding: 1px 8px;
    font-size: 12px;
}
.nd-pop-title {
    margin: 6px 0;
    font-family: var(--bs-font-primary);
    font-weight: 500;
    font-size: 15px;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.nd-pop-title a { color: var(--nw-navy-deep); text-decoration: none; }
/* ลิงก์หัวข้อขยายเต็มแถว - กดรูปก็เข้าข่าวได้ */
.nd-pop-title a::after { content: ""; position: absolute; inset: 0; }
.nd-pop-title a:focus-visible { outline: 0; }
.nd-pop:has(a:focus-visible) { outline: 3px solid rgba(85, 112, 208, .55); outline-offset: 4px; border-radius: 8px; }
.nd-pop:hover .nd-pop-title a { color: var(--nw-red); }

@media (max-width: 1399.98px) {
    .nd-layout.has-aside { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 1199.98px) {
    .nd-title { font-size: 24px; }
}
/* คอลัมน์ข้างลงไปอยู่ใต้เนื้อหา ข่าวยอดนิยมเรียง 2 คอลัมน์ */
@media (max-width: 991.98px) {
    .nd-layout.has-aside { grid-template-columns: minmax(0, 1fr); }
    .nd-popular {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px 24px;
    }
}
@media (max-width: 767.98px) {
    .nd-head { grid-template-columns: minmax(0, 1fr); }
    .nd-cover { aspect-ratio: 16 / 10; }
    .nd-popular { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 575.98px) {
    .nd-title { font-size: 22px; }
}
