.luxury-heading-bar {
    position: relative;
    text-align: center;
    background: linear-gradient(135deg, #141E30, #243B55);
    color: white;
    padding: 20px 25px;
    margin: 30px 0;
    border-radius: 8px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.luxury-heading-bar h2 {
    font-size: 26px;
    font-weight: 600;
    margin: 0;
    padding: 0;
    position: relative;
    z-index: 1;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 1px;
}

.luxury-heading-bar.wine {
    background: linear-gradient(135deg, #4E0F23, #8B1F41, #4E0F23);
}
.wp-block-image img {
  border: none !important;
}
.luxury-heading-bar {
    position: relative;
    text-align: center;
    background: linear-gradient(135deg, #6e1536, #8e2249);
    color: white;
    padding: 10px 15px;
    margin: 15px 0;
    border-radius: 6px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.luxury-heading-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.05) 25%, transparent 25%, 
                transparent 50%, rgba(255, 255, 255, 0.05) 50%, 
                rgba(255, 255, 255, 0.05) 75%, transparent 75%, transparent);
    background-size: 8px 8px;
    opacity: 0.4;
}

.luxury-heading-bar h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    padding: 0;
    position: relative;
    z-index: 1;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.luxury-heading-bar h2:before {
    margin-right: 10px;
    font-size: 22px;
}

.luxury-heading-bar.prevention h2:before {
    content: "🚓";
}
.luxury-heading-bar.prevention {
    background: linear-gradient(135deg, #8B6B2B, #D4AF37, #8B6B2B);
}

.luxury-heading-bar.traffic h2:before {
    content: "👮";
}
.luxury-heading-bar.traffic {
    background: linear-gradient(135deg, #0F2027, #203A43, #2C5364);
}

.luxury-heading-bar.investigation h2:before {
    content: "🔍";
}
.luxury-heading-bar.investigation {
    background: linear-gradient(135deg, #1A237E, #3949AB, #1A237E);
}

.luxury-heading-bar.interrogation h2:before {
    content: "📋";
}
.luxury-heading-bar.interrogation {
    background: linear-gradient(135deg, #26184A, #4A1E66, #26184A);
}

.luxury-heading-bar.administration h2:before {
    content: "📊";
}
.luxury-heading-bar.administration {
    background: linear-gradient(135deg, #1B5E20, #2E7D32, #1B5E20);
}

.loading-message {
    text-align: center;
    padding: 20px;
    font-style: italic;
    color: #666;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 25px;
}

@media (min-width: 768px) {
    .posts-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.post-card {
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    background-color: white;
    height: 100%;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: all 0.2s ease;
}

.post-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transform: translateY(-2px);
}

.post-image {
    width: 100%;
    height: 140px;
    border-bottom: 1px solid #eee;
    position: relative;
    overflow: hidden;
    background-color: #f5f5f5;
}

.post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.post-image iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ส่วนเนื้อหา */
.post-content {
    padding: 10px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.post-date {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.post-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
    line-height: 1.3;
}

.post-message {
    font-size: 12px;
    color: #555;
    flex-grow: 1;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.post-image-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
}

.post-card.prevention .post-image-icon {
    color: #D4AF37;
}

.post-card.traffic .post-image-icon {
    color: #2C5364;
}

.post-card.investigation .post-image-icon {
    color: #3949AB;
}

.post-card.interrogation .post-image-icon {
    color: #4A1E66;
}

.post-card.administration .post-image-icon {
    color: #2E7D32;
}

.post-modal-bg {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    overflow: auto;
}

.post-modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 20px;
    border-radius: 8px;
    max-width: 800px;
    width: 90%;
    position: relative;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.post-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #777;
    cursor: pointer;
}

.post-modal-close:hover {
    color: #333;
}

.post-modal-image {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    margin-bottom: 20px;
    border-radius: 4px;
}

.post-modal-date {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.post-modal-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.post-modal-message {
    font-size: 16px;
    line-height: 1.6;
    color: #444;
    margin-bottom: 20px;
    white-space: pre-line;
}

/* Frame 2: สไตล์เอกสารราชการ */
.pdf-frame-2 {
    max-width: 100%;
    margin: 20px 0;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    border: 2px solid #c8a415;
}

.pdf-frame-2 .pdf-title {
    background-color: #c8a415;
    color: #333;
    padding: 12px 15px;
    font-size: 18px;
    text-align: left;
    position: relative;
    font-weight: bold;
}

.pdf-frame-2 .pdf-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(to right, #c8a415, #f1c40f, #c8a415);
}

.pdf-frame-2 .pdf-content {
    position: relative;
    padding-top: 129%; /* สำหรับอัตราส่วน A4 */
    background-color: #f9f9f9;
}

.pdf-frame-2 iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* การปรับขนาดความสูงตามต้องการ */
.height-600px .pdf-content {
    padding-top: 0 !important;
    height: 600px !important;
}

.height-800px .pdf-content {
    padding-top: 0 !important;
    height: 800px !important;
}

/* สำหรับการแสดงผลบนมือถือ */
@media (max-width: 767px) {
    .pdf-frame-2 {
        margin: 15px 0;
    }
    
    .pdf-frame-2 .pdf-title {
        font-size: 16px !important;
        padding: 10px !important;
    }
    
    .height-600px .pdf-content,
    .height-800px .pdf-content {
        height: 400px !important;
    }
}

/* ============================================================
   หน้า E-Service (/e-service/, page-id-538) เท่านั้น
   โลโก้ตั้งค่าไว้ width:auto;height:100px ในตัวรูป แต่คอลัมน์บีบความกว้างแคบกว่านั้น
   ความสูงเลยคงที่ 100px ไม่ลดตาม ทำให้ภาพยืดเป็นทรงสูงเสียสัดส่วน
   ============================================================ */
.page-id-538 .wp-block-image img {
    width: auto !important;
    height: auto !important;
    max-height: 100px !important;
    max-width: 100% !important;
}

/* ============================================================
   ทั้งเว็บ (global) — หัวข้อกลุ่มเดือน (.month-heading) ชิดด้านบนไป
   ห่างจากการ์ดของตัวเองด้านล่างมากเกินไป ปรับให้แยกจากเดือนก่อนหน้าชัดเจนขึ้น
   แต่ชิดกับเนื้อหาของตัวเองมากขึ้น
   ============================================================ */
.month-heading {
    margin: 32px 0 2px !important;
    padding-bottom: 2px !important;
}

/* ============================================================
   ทั้งเว็บ (global) — หน้าผลการปฏิบัติรายสายงาน (dept_report shortcode)
   บังคับ 2 คอลัมน์เสมอ ไม่ให้เหลือพื้นที่ว่างเป็นคอลัมน์ผีตอนมีการ์ดไม่ครบแถว
   ============================================================ */
.dept-report-container .posts-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    max-width: 600px;
    margin: 0 auto;
    gap: 16px !important;
}

.dept-report-container .post-card {
    max-width: 100%;
}

/* ============================================================
   ทั้งเว็บ (global) — ปรับ luxury-heading-bar (แถบหัวข้อสายงาน) ให้เป็นทางการ
   สีเดียวกันหมดทุกสายงาน (กรมท่า/Navy) เอาลายทางเฉียงและสีรุ้งต่างกันตามสายงานออก
   ครอบคลุมทุก class variant ที่เจอจากการสแกนโพสต์เก่า (สแกนเจอ 30 แบบไม่ซ้ำกัน)
   ============================================================ */
.luxury-heading-bar,
.luxury-heading-bar2,
.luxury-heading-bar.wine,
.luxury-heading-bar.blue,
.luxury-heading-bar.gold,
.luxury-heading-bar.silver,
.luxury-heading-bar.crystal,
.luxury-heading-bar.royal,
.luxury-heading-bar.prevention,
.luxury-heading-bar.traffic,
.luxury-heading-bar.investigation,
.luxury-heading-bar.interrogation,
.luxury-heading-bar.administration,
.luxury-heading-bar.inspector,
.luxury-heading-bar2.gold {
    background: #14274E !important;
    border: none !important;
    border-bottom: 3px solid #C9A227 !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15) !important;
    border-radius: 4px !important;
    padding: 8px 20px !important;
    margin: 6px 0 !important;
}

.luxury-heading-bar::before,
.luxury-heading-bar2::before {
    display: none !important;
}

.luxury-heading-bar h2,
.luxury-heading-bar2 h2 {
    font-size: 18px !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px !important;
    text-shadow: none !important;
}

/* เอาไอคอนอิโมจิหน้าข้อความออก (มาจาก h2::before ของแต่ละสายงาน) */
.luxury-heading-bar h2::before,
.luxury-heading-bar2 h2::before {
    content: none !important;
    display: none !important;
}

/* ============================================================
   ทั้งเว็บ (global) — ปุ่ม "แสดงเพิ่มเติม" ไม่ต้องเป็นปุ่ม ใช้ข้อความเล็กๆ แทน
   ============================================================ */
.show-more-container {
    margin: 0 !important;
    padding: 0 !important;
}

.show-more-btn {
    background: none !important;
    box-shadow: none !important;
    color: #555 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    font-size: 12px !important;
    font-weight: 400 !important;
    display: inline-block !important;
}

.show-more-btn:hover,
.show-more-btn:active {
    background: none !important;
    box-shadow: none !important;
    transform: none !important;
}

.show-more-btn::after {
    content: none !important;
}

/* ============================================================
   ทั้งเว็บ (global) — ลด margin/padding ส่วนหัวเว็บ (#header-content)
   ที่เหลือช่องว่างเปล่าๆ ระหว่างโลโก้/แบนเนอร์ ทุกหน้า
   ============================================================ */
#header-content {
    margin: 0 !important;
    padding: 0 !important;
}

/* ============================================================
   หน้า ITA 2026 (/ita/, page-id-213) เท่านั้น
   ปัญหาที่พบจากการตรวจสอบจริง:
   1) รูป "หัวข้อย่อย" (ไอคอนลิงก์ในคอลัมน์ O1-O25) ไม่ได้กำหนด max-width
      พอคอลัมน์ยุบเป็น 1 คอลัมน์บนมือถือ รูปจะขยายเท่ารูป "หัวข้อหลัก" (แบนเนอร์ M1-M12
      ที่ fix ไว้ 300px) ทำให้ลำดับความสำคัญของหัวข้อดูสลับกัน
   2) รูปแต่ละบล็อกมี margin-bottom 28px ของธีมเดิม คูณด้วยรูปกว่า 28 รูปในหน้าเดียว
      ทำให้ระยะห่างสะสมมากเกินไป
   ============================================================ */
.page-id-213 .wp-block-column .wp-block-image img {
    max-width: 270px; /* หัวข้อหลักเต็ม container อยู่แล้ว (~283px) ขยับหัวข้อย่อยใกล้เพดานสุดโดยไม่แซง */
    margin: 0 auto;
    display: block;
}

/* ไม่ต้องมี margin เพราะ gap ของ flex container (ด้านล่าง) ให้ระยะห่างเพียงพอแล้ว
   ใส่ทั้งสองอย่างซ้อนกันทำให้ห่างเกินจำเป็น */
.page-id-213 .wp-block-image {
    margin-bottom: 0 !important;
}

.page-id-213 .wp-block-columns {
    margin-bottom: 4px;
}

/* column เปล่า (เดิมมีไว้จัดสมดุล 3 คอลัมน์บน desktop) ยังกิน flex gap 32px
   ทั้งที่ไม่มีเนื้อหา พอยุบเป็นคอลัมน์เดียวบนมือถือเลยเห็นเป็นช่องว่างขนาดใหญ่ */
.page-id-213 .wp-block-column:empty {
    display: none;
}

/* gap 32px ของธีมออกแบบมาสำหรับช่องว่างระหว่างคอลัมน์ที่วางเคียงกันบน desktop
   พอยุบเป็นคอลัมน์เดียวเรียงต่อกันบนมือถือ กลายเป็นช่องว่างแนวตั้งเยอะเกินไป */
@media (max-width: 600px) {
    .page-id-213 .wp-block-columns.is-layout-flex {
        gap: 8px;
    }
}