body {
    background-color: #f5f6fa;
}

/* Navbar Styles - สมูทและสวยงาม */
.navbar {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
}

.navbar:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* เว้นช่องว่างระหว่างเมนูหลักกับโซนเนื้อหาด้านล่าง */
.navbar + .layout-slideshow,
.navbar + main {
    margin-top: 1rem;
}

.navbar-brand {
    align-items: center;
    display: flex;
    min-height: 3.25rem;
}

/* ปุ่ม 3 ขีด → X: ใช้ 3 แท่งเท่านั้น + translateY/rotate (แบบ Bulma) — ห้ามใช้ 4 แท่งเพราะแท่งที่ 4 จะค้างเป็นขีดกลาง */
.navbar-burger {
    margin-left: auto;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    color: inherit;
    flex-shrink: 0;
}

.navbar-burger:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.navbar-burger span {
    display: block;
    width: 16px;
    height: 2px;
    background-color: currentColor;
    border-radius: 1px;
    position: absolute;
    left: calc(50% - 8px);
    transform-origin: center;
    transition-duration: 0.15s;
    transition-property: opacity, transform;
    transition-timing-function: ease-out;
}

.navbar-burger span:nth-child(1) {
    top: calc(50% - 8px);
}

.navbar-burger span:nth-child(2) {
    top: calc(50% - 1px);
}

.navbar-burger span:nth-child(3) {
    top: calc(50% + 6px);
}

.navbar-burger.is-active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.navbar-burger.is-active span:nth-child(2) {
    opacity: 0;
}

.navbar-burger.is-active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* มือถือ/แท็บเล็ต: ย่อขยายด้วย grid 0fr → 1fr (ไม่ใช้ max-height — ลื่นกว่า) */
.navbar-menu-clip {
    display: grid;
    grid-template-rows: 0fr;
    width: 100%;
    transition: grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar-menu-clip.is-active {
    grid-template-rows: 1fr;
}

@media (prefers-reduced-motion: reduce) {
    .navbar-menu-clip {
        transition-duration: 0.01ms;
    }
}

.navbar-menu-clip__inner {
    min-height: 0;
    overflow: hidden;
}

/* ตรวจสอบให้แน่ใจว่า menu แสดงใน desktop */
@media screen and (min-width: 1024px) {
    .navbar-menu-clip,
    .navbar-menu-clip__inner {
        display: contents;
    }

    .navbar-menu {
        display: flex !important;
    }
}

.navbar-item,
.navbar-link {
    transition: background-color 0.2s ease, color 0.2s ease;
    position: relative;
}

.navbar-item:hover,
.navbar-link:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #3273dc;
}

.navbar-item:active,
.navbar-link:active {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Navbar Dropdown Styles */
.navbar-item.has-dropdown {
    position: relative;
}

.navbar-item.has-dropdown .navbar-dropdown {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    margin-top: 0;
    padding: 0.5rem 0;
    padding-top: 0.75rem;
    min-width: 200px;
}

/* สร้างพื้นที่เชื่อมต่อระหว่างเมนูหลักกับเมนูย่อย */
.navbar-item.has-dropdown::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 0.75rem;
    background: transparent;
    z-index: 1;
}

.navbar-item.has-dropdown.is-active .navbar-dropdown,
.navbar-item.has-dropdown:hover .navbar-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.navbar-dropdown .navbar-item {
    padding: 0.5rem 1.5rem;
    white-space: nowrap;
}

.navbar-dropdown .navbar-item:hover {
    background-color: rgba(50, 115, 220, 0.1);
    color: #3273dc;
}

/* Mobile Navbar Styles */
@media screen and (max-width: 1023px) {
    .navbar-menu-clip:not(.is-active) .navbar-menu {
        pointer-events: none;
    }

    .navbar-menu {
        display: block !important;
        overflow: visible;
        padding: 0;
    }

    .navbar-menu-clip.is-active .navbar-menu {
        padding: 0.5rem 0;
    }

    .navbar-item.has-dropdown {
        flex-direction: column;
    }

    .navbar-item.has-dropdown .navbar-dropdown {
        position: static !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        box-shadow: none;
        background-color: rgba(0, 0, 0, 0.05);
        margin-top: 0;
        padding-left: 1.5rem;
        display: none;
        width: 100%;
    }

    .navbar-item.has-dropdown.is-active .navbar-dropdown {
        display: block;
    }

    .navbar-item.has-dropdown .navbar-link {
        width: 100%;
        padding-right: 2.5rem;
    }

    .navbar-item.has-dropdown .navbar-link::after {
        content: '';
        position: absolute;
        right: 1rem;
        top: 50%;
        transform: translateY(-50%) rotate(0deg);
        width: 0;
        height: 0;
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;
        border-top: 6px solid currentColor;
        border-bottom: none;
        transition: transform 0.3s ease;
        display: inline-block;
    }

    .navbar-item.has-dropdown.is-active .navbar-link::after {
        /* Rotate the arrow 180 degrees */
        transform: translateY(-50%) rotate(180deg);
        border-top: 6px solid currentColor;
        border-bottom: none;
    }
}

/* Desktop Navbar Styles */
@media screen and (min-width: 1024px) {
    .navbar-menu {
        display: flex !important;
        max-height: none !important;
        opacity: 1 !important;
        overflow: visible !important;
        padding: 0 !important;
        visibility: visible !important;
        transform: none !important;
        transition: none;
        pointer-events: auto !important;
    }

    .navbar-burger {
        display: none;
    }

    .navbar-item.has-dropdown .navbar-dropdown {
        position: absolute;
        top: 100%;
        left: 0;
        margin-top: 0;
        padding-top: 0.75rem;
    }

    .navbar-item.has-dropdown.is-hoverable:hover .navbar-dropdown,
    .navbar-item.has-dropdown:hover .navbar-dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    /* สร้างพื้นที่เชื่อมต่อสำหรับ desktop */
    .navbar-item.has-dropdown::before {
        content: '';
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        height: 0.75rem;
        background: transparent;
        z-index: 1;
    }

    .navbar-item.has-dropdown.is-hoverable:hover::before,
    .navbar-item.has-dropdown:hover::before {
        z-index: 1;
    }

    /* Desktop dropdown arrow - แสดงสามเหลี่ยมชี้ลงเมื่อ hover (เหมือน mobile) */
    .navbar-item.has-dropdown .navbar-link::after {
        content: '' !important;
        margin-left: 0.5rem;
        width: 0 !important;
        height: 0 !important;
        border-left: 5px solid transparent !important;
        border-right: 5px solid transparent !important;
        border-top: 6px solid currentColor !important;
        border-bottom: none !important;
        transition: border 0.3s ease !important;
        display: inline-block !important;
        position: relative !important;
        right: auto !important;
        vertical-align: middle !important;
        background: none !important;
        padding: 0 !important;
        font-size: 0 !important;
    }

    .navbar-item.has-dropdown.is-hoverable:hover .navbar-link::after,
    .navbar-item.has-dropdown:hover .navbar-link::after {
        border-top: none !important;
        border-bottom: 6px solid currentColor !important;
        transform: none !important;
    }
}

.content-section {
    padding: 3rem 1.5rem;
}

.feature-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -15px rgba(10, 10, 10, 0.3);
}

/* Post page layout — article ใช้ class "content post-content" พร้อมกัน จึงเล็ง .post-content โดยตรง */
.post-content {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
}

/* รูปในเนื้อหา: จำกัดความกว้างไม่เกินคอลัมน์ + คงอัตราส่วน (รองรับ width/height จากตัวแก้ไข) */
.post-content img {
    max-width: 100%;
    width: auto;
    height: auto;
    display: block;
    margin: 1.5rem auto;
    border-radius: 8px;
    box-sizing: border-box;
}

.post-content figure {
    max-width: 100%;
    margin: 1.5rem auto;
}

.post-content figure img {
    margin: 0 auto;
}

/* กรณี editor ใส่คลาส .image หรือกำหนดขนาดคงที่มา ให้รูปในบทความ fit พื้นที่เสมอ */
.post-content .image {
    max-width: 100% !important;
    margin: 1.5rem auto;
}

.post-content .image img:not(.post-featured-image-fit__img) {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
    object-position: center !important;
}

.post-content p {
    margin-bottom: 1.5rem;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

/* วิดีโอ/iframe แทรกในเนื้อหา */
.post-content iframe,
.post-content video {
    max-width: 100%;
    display: block;
    margin: 1.5rem auto;
}

@media screen and (max-width: 1023px) {
    .post-content img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
        object-position: center !important;
    }
}

/* หน้าแสดงบทความ: รูปประจำเรื่องและ PDF ให้ fit ตามพื้นที่คอลัมน์ */
.post-featured-image-fit {
    margin: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #f4f5f7;
    aspect-ratio: 16 / 9;
}

.post-featured-image-fit__img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

/* กันกฎ .post-content img ทับรูปประจำเรื่องหน้าโพสต์ */
.post-content .post-featured-image-fit__img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    margin: 0 !important;
}

.pdf-embed-container--fit {
    position: relative;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 210 / 297;
    min-height: 520px;
    border: 1px solid #ddd;
    background: #f9f9f9;
    overflow: hidden;
}

.pdf-embed-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* Share Buttons */
.share-buttons {
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.share-buttons .buttons {
    flex-wrap: wrap;
    gap: 0.5rem;
}

.share-btn {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
    font-weight: 500;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.share-line {
    background-color: #00C300;
    color: white;
}

.share-line:hover {
    background-color: #00B300;
    color: white;
}

.share-facebook {
    background-color: #1877F2;
    color: white;
}

.share-facebook:hover {
    background-color: #166FE5;
    color: white;
}

.share-x {
    background-color: #000000;
    color: white;
}

.share-x:hover {
    background-color: #1a1a1a;
    color: white;
}

.share-threads {
    background-color: #000000;
    color: white;
}

.share-threads:hover {
    background-color: #1a1a1a;
    color: white;
}

/* Layout Hero Banner */
.layout-hero {
    height: 250px;
    min-height: 250px;
    max-height: 250px;
    display: flex;
    align-items: center;
    position: relative;
    padding: 0;
    color: #ffffff !important;
    overflow: hidden;
}

.layout-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--hero-overlay-color, #000000);
    opacity: var(--hero-overlay-opacity, 0.3);
    z-index: 1;
}

.layout-hero .hero-body {
    position: relative;
    z-index: 2;
    width: 100%;
    color: #ffffff !important;
}

.layout-hero .title,
.layout-hero .subtitle,
.layout-hero h1,
.layout-hero h2,
.layout-hero h3,
.layout-hero h4,
.layout-hero h5,
.layout-hero h6,
.layout-hero p,
.layout-hero span,
.layout-hero div {
    color: #ffffff !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.layout-hero .button {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.layout-hero .button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.layout-hero-logo,
.layout-header-logo {
    height: 64px;
    width: auto;
    max-width: 240px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 0.5rem;
    border-radius: 4px;
    background: transparent;
    padding: 2px 4px;
    opacity: 1;
}

/* โลโก้อยู่ข้างกล่องข้อความ — tagline เริ่มตรงตัวอักษรแรกของชื่อเว็บ */
.layout-header-brand {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.layout-header-brand-text {
    flex: 1;
    min-width: 0;
}

.layout-header-brand .layout-header-logo--aside {
    margin-right: 0;
    flex-shrink: 0;
}

.layout-header-brand-text .subtitle {
    margin-top: 0.15rem;
}

.layout-hero-brand .layout-hero-logo.layout-header-logo--aside {
    margin-right: 0;
}

@media screen and (max-width: 768px) {
    .layout-hero {
        height: 250px;
        min-height: 250px;
        max-height: 250px;
        padding: 0;
    }

    .layout-hero .title.is-1 {
        font-size: 1.75rem !important;
    }

    .layout-hero .subtitle.is-4 {
        font-size: 1.125rem !important;
    }
}

/* PR Banner — วิดเจ็ตแบนเนอร์ในโซน body (ไม่มีจุด/ปุ่มนำทาง) */
.pr-banner-widget {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.1);
    width: 100%;
    max-width: 100%;
}

.pr-banner-widget .pr-banner-inner {
    position: relative;
    height: var(--pr-banner-height, 260px);
    min-height: 120px;
}

.pr-banner-widget .pr-banner-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.55s ease;
    pointer-events: none;
    z-index: 1;
}

.pr-banner-widget .pr-banner-slide.is-active {
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}

.pr-banner-widget .pr-banner-slide img,
.pr-banner-widget .pr-banner-slide .pr-banner-link {
    display: block;
    width: 100%;
    height: 100%;
}

.pr-banner-widget .pr-banner-slide img {
    object-fit: cover;
    object-position: top center;
}

/* มือถือ/แท็บเล็ต: Advertise แสดงภาพเต็มรูป (ไม่ครอป) */
@media screen and (max-width: 1023px) {
    .pr-banner-widget[data-render-zone="below_slideshow_primary"] {
        background: #f3f3f3;
    }
    .pr-banner-widget[data-render-zone="below_slideshow_secondary"] {
        background: #f3f3f3;
    }
    .pr-banner-widget[data-render-zone="below_slideshow_tertiary"] {
        background: #f3f3f3;
    }
    .pr-banner-widget[data-render-zone="below_slideshow_primary"] .pr-banner-slide img,
    .pr-banner-widget[data-render-zone="below_slideshow_secondary"] .pr-banner-slide img,
    .pr-banner-widget[data-render-zone="below_slideshow_tertiary"] .pr-banner-slide img {
        object-fit: contain;
        object-position: center;
    }
}

/* สถิตินักเรียน — ในโซน Advertise แบบ 60:40 คอลัมน์ 40% แคบ ลดหัวข้อหนึ่งขั้น */
.layout-below-slideshow--split-60-40 .column.is-5-desktop .student-stats-widget__title {
    font-size: clamp(0.9rem, 1.45vw, 1.5rem);
}

/* จดหมายข่าว — แกลเลอรี A4 แนวตั้ง + แบ่งหน้า (JS) */
.newsletter-gallery-widget .newsletter-gallery__grid {
    display: grid;
    gap: 1rem;
    align-items: start;
}

.newsletter-gallery-widget .newsletter-gallery__cell {
    min-width: 0;
}

.newsletter-gallery-widget .newsletter-gallery__figure {
    margin: 0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    background: #f0f0f0;
    position: relative;
}

/* สถิติการเข้าชม — มุมขวาบน พร้อมไอคอนตา */
.newsletter-gallery-widget .newsletter-gallery__stat {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    z-index: 2;
    min-height: 1.75rem;
    padding: 0.2rem 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    border-radius: 999px;
    /* พื้นหลังโปร่ง ~80% (ทึบ ~20%) */
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
    pointer-events: none;
}

.newsletter-gallery-widget .newsletter-gallery__stat .icon {
    font-size: 0.72rem;
}

.newsletter-gallery-widget .newsletter-gallery__stat-value {
    font-variant-numeric: tabular-nums;
}

.newsletter-gallery-widget .newsletter-gallery__img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 794 / 1123;
    object-fit: contain;
    object-position: top center;
}

.newsletter-gallery-widget .newsletter-gallery__cell--clickable {
    cursor: pointer;
}

.newsletter-gallery-widget .newsletter-gallery__cell--clickable:hover .newsletter-gallery__figure {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.newsletter-gallery-widget .newsletter-gallery__cell--clickable:focus {
    outline: 2px solid #3273dc;
    outline-offset: 3px;
}

.newsletter-gallery-widget .gallery-widget-title-link,
.youtube-gallery-widget .gallery-widget-title-link {
    text-decoration: none;
}

.newsletter-gallery-widget .gallery-widget-title-link:hover,
.youtube-gallery-widget .gallery-widget-title-link:hover {
    text-decoration: underline;
}

/* หน้ารายการจดหมายข่าวทั้งหมด — คลิกขยายภาพ */
.newsletter-gallery-archive-card figure.image.is-4by3 {
    position: relative;
}

.newsletter-gallery-archive-card .newsletter-archive-thumb-btn {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    padding: 0;
    margin: 0;
    cursor: zoom-in;
    border-radius: 6px;
    overflow: hidden;
    background: #f0f0f0;
}

.newsletter-gallery-archive-card .newsletter-archive-thumb-btn:focus {
    outline: 2px solid #3273dc;
    outline-offset: 2px;
}

.newsletter-gallery-archive-card .newsletter-archive-thumb-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Lightbox ภาพเต็ม (Bulma modal) */
.newsletter-gallery-lightbox.modal.is-active {
    z-index: 10000;
}

.newsletter-gallery-lightbox .modal-content {
    background: transparent;
    box-shadow: none;
    max-width: 98vw;
    max-height: 98vh;
    overflow: visible;
}

.newsletter-gallery-lightbox .modal-background {
    background: rgba(0, 0, 0, 0.88);
}

.newsletter-gallery-lightbox .newsletter-gallery-lightbox-img {
    max-height: 90vh;
    width: auto;
    max-width: 96vw;
    margin: 0 auto;
    display: block;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
}

.newsletter-gallery-lightbox .newsletter-lightbox-zoom-viewport {
    max-width: 98vw;
    max-height: 92vh;
    overflow: auto;
    margin: 0 auto;
    -webkit-overflow-scrolling: touch;
    text-align: center;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
    background: rgba(0, 0, 0, 0.25);
    cursor: grab;
}

.newsletter-gallery-lightbox .newsletter-lightbox-zoom-viewport:active {
    cursor: grabbing;
}

.newsletter-gallery-lightbox .newsletter-lightbox-zoom-viewport .newsletter-gallery-lightbox-img {
    max-height: none !important;
    max-width: none !important;
    width: auto;
    height: auto;
    margin: 0 auto;
    display: inline-block;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: none;
    vertical-align: top;
}

.newsletter-gallery-lightbox .modal-close {
    z-index: 10001;
}

.newsletter-gallery-widget .newsletter-gallery__pager .pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.newsletter-gallery-widget .newsletter-gallery__pager .pagination-previous {
    order: 1;
}

.newsletter-gallery-widget .newsletter-gallery__pager .pagination-list {
    order: 2;
}

.newsletter-gallery-widget .newsletter-gallery__pager .pagination-next {
    order: 3;
}

/* YouTube Gallery */
.youtube-gallery-widget .youtube-gallery__grid {
    display: grid;
    gap: 1rem;
    align-items: start;
}

.youtube-gallery-widget .youtube-gallery__cell {
    min-width: 0;
}

.youtube-gallery-widget .youtube-gallery__thumb-btn {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.youtube-gallery-widget .youtube-gallery__figure {
    margin: 0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    background: #111;
}

.youtube-gallery-widget .youtube-gallery__img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.youtube-gallery-widget .youtube-gallery__play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.35rem;
    background: rgba(0, 0, 0, 0.28);
    transition: background 0.2s ease;
}

.youtube-gallery-widget .youtube-gallery__thumb-btn:hover .youtube-gallery__play,
.youtube-gallery-widget .youtube-gallery__thumb-btn:focus .youtube-gallery__play {
    background: rgba(0, 0, 0, 0.4);
}

.youtube-gallery-widget .youtube-gallery__stat {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    z-index: 3;
    min-height: 1.75rem;
    padding: 0.2rem 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    border-radius: 999px;
    /* พื้นหลังโปร่ง ~80% (ทึบ ~20%) */
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
    pointer-events: none;
}

.youtube-gallery-widget .youtube-gallery__stat .icon {
    font-size: 0.72rem;
}

.youtube-gallery-widget .youtube-gallery__stat-value {
    font-variant-numeric: tabular-nums;
}

.youtube-gallery-widget .youtube-gallery__pager .pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.youtube-gallery-lightbox.modal.is-active {
    z-index: 10000;
}

.youtube-gallery-lightbox .modal-background {
    background: rgba(0, 0, 0, 0.88);
}

.youtube-gallery-lightbox .youtube-gallery-lightbox-panel {
    max-width: 96vw;
}

.youtube-gallery-lightbox .youtube-gallery-lightbox-wrap {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
}

.youtube-gallery-lightbox .youtube-gallery-lightbox-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 6px;
}

@media screen and (max-width: 768px) {
    .newsletter-gallery-widget .newsletter-gallery__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
    .youtube-gallery-widget .youtube-gallery__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media screen and (max-width: 480px) {
    .newsletter-gallery-widget .newsletter-gallery__grid {
        grid-template-columns: 1fr !important;
    }
    .youtube-gallery-widget .youtube-gallery__grid {
        grid-template-columns: 1fr !important;
    }
}

/* Layout Slideshow */
.layout-slideshow {
    padding: 0 1.5rem;
    background: #f5f5f5;
    overflow: visible;
    width: 100%;
    position: relative;
}

.layout-slideshow .container {
    position: relative;
}

.layout-slideshow__track {
    display: block;
    width: 100%;
    position: relative;
    /* ให้รูปสไลด์กว้างเท่ากับโซน body + sidebar */
    padding-left: 0;
    padding-right: 0;
}

/* มือถือ/แท็บเล็ต: คอลัมน์เต็มความกว้าง — โหมด Advertise เต็มแถวใช้ความกว้างเท่า .container โดยไม่มี gutter คู่
   ถ้าเก็บ padding ของ track ไว้ รูปสไลด์จะแคบกว่าโฆษณาด้านล่าง */
@media screen and (max-width: 1023px) {
    .layout-slideshow__track {
        padding-left: 0;
        padding-right: 0;
    }
}

/* กรอบสไลด์คงอัตราส่วน 4:1 — ปุ่มควบคุมซ้อนที่ขอบล่าง ไม่ดันพื้นที่ */
.layout-slideshow__viewport {
    position: relative;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    aspect-ratio: 4 / 1;
    height: auto;
    border-radius: 6px;
    overflow: hidden;
    background: transparent;
    box-shadow: 0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.1);
}

.layout-slideshow__slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    pointer-events: none;
    z-index: 1;
    visibility: hidden;
}

.layout-slideshow__slide.active {
    opacity: 1;
    z-index: 2;
    visibility: visible;
}

.layout-slideshow__slide img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
}

/* แถบควบคุมซ้อนทับรูปด้านล่าง — โปร่ง 50% ให้เห็นภาพด้านล่าง */
.layout-slideshow__controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    pointer-events: auto;
}

.layout-slideshow__nav {
    flex-shrink: 0;
    appearance: none;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.95);
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s ease, color 0.2s ease;
    line-height: 1;
}

.layout-slideshow__nav:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.layout-slideshow__nav:focus {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

.layout-slideshow__dots {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
}

.layout-slideshow__dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease;
    outline: none;
}

.layout-slideshow__dot:hover {
    background: rgba(255, 255, 255, 0.65);
    border-color: rgba(255, 255, 255, 0.85);
    transform: scale(1.15);
}

.layout-slideshow__dot.active {
    background: #fff;
    border-color: #fff;
    width: 32px;
    border-radius: 6px;
}

.layout-slideshow__dot:focus {
    outline: 2px solid rgba(255, 255, 255, 0.85);
    outline-offset: 2px;
}

/* Advertise โซน (below_slideshow) — ความกว้างเดียวกับ .container ของ body + sidebar */
.layout-below-slideshow {
    background-color: #f5f6fa;
}

/* ลดระยะห่างระหว่างโซน Advertise กับโซน body */
.layout-below-slideshow.section {
    padding-bottom: 0.375rem !important;
}

.layout-below-slideshow + main > .section:first-child {
    padding-top: 0.5rem;
}

.layout-below-slideshow .container > .columns {
    margin-top: 0;
    margin-bottom: 0;
}

.layout-below-slideshow__full > *:not(:last-child) {
    margin-bottom: 1rem;
}

.layout-below-slideshow__cell > *:last-child {
    margin-bottom: 0 !important;
}

.layout-below-slideshow--split-60-40 {
    margin-top: 0;
    margin-bottom: 0;
}

/* Advertise #1 (50:50) บนเดสก์ท็อป: ให้สองฝั่งสูงเท่ากัน */
@media screen and (min-width: 1024px) {
    .layout-below-slideshow--split-50-50 {
        align-items: stretch;
    }
    .layout-below-slideshow--split-50-50 > .layout-below-slideshow__cell {
        display: flex;
    }
    .layout-below-slideshow--split-50-50 > .layout-below-slideshow__cell > * {
        width: 100%;
        margin-bottom: 0 !important;
    }
    .layout-below-slideshow--split-50-50 > .layout-below-slideshow__cell .pr-banner-widget {
        height: 100%;
    }
    .layout-below-slideshow--split-50-50 > .layout-below-slideshow__cell .pr-banner-widget .pr-banner-inner {
        height: 100%;
    }
}

@media screen and (max-width: 768px) {
    .share-btn {
        font-size: 0.875rem;
    }

    .share-btn .icon {
        margin-right: 0.25rem !important;
    }
}

/* Home Page Styles */
.post-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #e9ecef;
    overflow: hidden;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.post-card-header .title a {
    transition: color 0.2s ease;
}

.post-card-header .title a:hover {
    color: #3273dc !important;
}

.student-stats-widget {
    background: #f4f4f4;
    border: none;
}

.student-stats-widget__title {
    font-size: clamp(1.05rem, 1.7vw, 1.75rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #2f2f33;
    text-align: center;
}

.student-stats-widget__grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1rem;
}

.student-stats-widget__card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e3e3e6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    text-align: center;
    padding: 1.25rem 0.75rem;
}

.student-stats-widget__icon {
    color: #1f78e8;
    font-size: 3rem;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.student-stats-widget__level {
    font-size: clamp(1.05rem, 1.5vw, 1.55rem);
    font-weight: 700;
    color: #5c5e63;
    margin-bottom: 0.6rem;
}

.student-stats-widget__value {
    font-size: 1.5rem;
    line-height: 1;
    font-weight: 800;
    color: #2f3136;
}

@media screen and (max-width: 1200px) {
    .student-stats-widget__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media screen and (max-width: 768px) {
    .student-stats-widget__grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
    .student-stats-widget__card {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        text-align: left;
        padding: 0.75rem 0.9rem;
    }
    .student-stats-widget__icon {
        font-size: 1.6rem;
        margin-bottom: 0;
        flex: 0 0 auto;
    }
    .student-stats-widget__level {
        margin-bottom: 0;
        font-size: 1rem;
        line-height: 1.2;
    }
    .student-stats-widget__value {
        margin-left: auto;
        font-size: 1.35rem;
        line-height: 1;
    }
}

/* ชื่อโพสต์หน้าเดี่ยว — เล็กลงอีกขั้นจาก title is-7 (Bulma ไม่มี is-8) */
article.post-content > h1.title.is-7 {
    font-size: 1.4rem !important;
    line-height: 1.35;
}

/* ชื่อโพสต์ในการ์ด / วิดเจ็ต — เล็กลงอีกขั้น (Bulma ไม่มี title is-8) */
.title.jant-post-card-title {
    font-size: 0.98rem !important;
    line-height: 1.35;
    font-weight: 400 !important;
}

.title.jant-post-card-title a {
    font-weight: 400 !important;
}

/* Post Thumbnail */
.post-thumbnail {
    margin: -1.5rem -1.5rem 1.5rem -1.5rem;
}

.post-thumbnail figure {
    margin: 0;
    overflow: hidden;
    background-color: #f5f5f5;
    position: relative;
    width: 100%;
}

/* กรอบ 16:9 + cover เพื่อให้ภาพเต็มกรอบ (ไม่สร้างไฟล์ครอปใหม่) */
.thumbnail-figure {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    position: relative;
}

.thumbnail-figure img {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: top center;
    transition: transform 0.3s ease, opacity 0.25s ease;
    opacity: 0;
}

.thumbnail-figure img.loaded {
    opacity: 1;
}

.post-thumbnail:hover img {
    transform: none;
}

.thumbnail-placeholder {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
}

.empty-state {
    padding: 3rem 1rem;
}

.empty-state-icon {
    opacity: 0.5;
}

/* Category List */
.category-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.category-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.category-item:last-child {
    border-bottom: none;
}

.category-item a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.2s ease;
}

.category-item a:hover {
    color: #3273dc !important;
}

/* Top Views List */
.top-views-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.top-views-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.top-views-item:last-child {
    border-bottom: none;
}

.top-views-item a {
    transition: color 0.2s ease;
}

.top-views-item a:hover {
    color: #3273dc !important;
}

.top-views-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background-color: #f5f5f5;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.875rem;
    color: #666;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.top-views-item:first-child .top-views-rank {
    background-color: #ffd700;
    color: #000;
}

/* Custom Button Colors */
.button.is-aqua,
.tag.is-aqua {
    background-color: #48cae4;
    border-color: transparent;
    color: #fff;
}

.button.is-aqua:hover,
.button.is-aqua.is-hovered {
    background-color: #36b5d4;
    border-color: transparent;
    color: #fff;
}

.button.is-pink,
.tag.is-pink {
    background-color: #ff8fab;
    border-color: transparent;
    color: #fff;
}

.button.is-pink:hover,
.button.is-pink.is-hovered {
    background-color: #ff7699;
    border-color: transparent;
    color: #fff;
}

.button.is-tomato,
.tag.is-tomato {
    background-color: #f06543;
    border-color: transparent;
    color: #fff;
}

.button.is-tomato:hover,
.button.is-tomato.is-hovered {
    background-color: #e34d28;
    border-color: transparent;
    color: #fff;
}

.button.is-purple,
.tag.is-purple {
    background-color: #B28AFC;
    border-color: transparent;
    color: #fff;
}

.button.is-purple:hover,
.button.is-purple.is-hovered {
    background-color: #9B6BFA;
    border-color: transparent;
    color: #fff;
}

.button.is-forest,
.tag.is-forest {
    background-color: #007f5f;
    border-color: transparent;
    color: #fff;
}

.button.is-forest:hover,
.button.is-forest.is-hovered {
    background-color: #00664c;
    border-color: transparent;
    color: #fff;
}

.button.is-violet,
.tag.is-violet {
    background-color: #935BFB;
    border-color: transparent;
    color: #fff;
}

.button.is-violet:hover,
.button.is-violet.is-hovered {
    background-color: #7A3FF9;
    border-color: transparent;
    color: #fff;
}

/* Extended palette — ปุ่มลิงค์ 24 สี (ต้องสอดคล้องกับ assets/css/admin.css) */
.button.is-crimson, .tag.is-crimson { background-color: #dc2626; border-color: transparent; color: #fff; }
.button.is-crimson:hover, .button.is-crimson.is-hovered { background-color: #b91c1c; border-color: transparent; color: #fff; }

.button.is-coral, .tag.is-coral { background-color: #ff6b6b; border-color: transparent; color: #fff; }
.button.is-coral:hover, .button.is-coral.is-hovered { background-color: #f04545; border-color: transparent; color: #fff; }

.button.is-orange, .tag.is-orange { background-color: #f97316; border-color: transparent; color: #fff; }
.button.is-orange:hover, .button.is-orange.is-hovered { background-color: #ea580c; border-color: transparent; color: #fff; }

.button.is-amber, .tag.is-amber { background-color: #f59e0b; border-color: transparent; color: rgba(0, 0, 0, 0.75); }
.button.is-amber:hover, .button.is-amber.is-hovered { background-color: #d97706; border-color: transparent; color: rgba(0, 0, 0, 0.85); }

.button.is-lime, .tag.is-lime { background-color: #84cc16; border-color: transparent; color: rgba(0, 0, 0, 0.75); }
.button.is-lime:hover, .button.is-lime.is-hovered { background-color: #65a30d; border-color: transparent; color: rgba(0, 0, 0, 0.85); }

.button.is-teal, .tag.is-teal { background-color: #14b8a6; border-color: transparent; color: #fff; }
.button.is-teal:hover, .button.is-teal.is-hovered { background-color: #0d9488; border-color: transparent; color: #fff; }

.button.is-sky, .tag.is-sky { background-color: #0ea5e9; border-color: transparent; color: #fff; }
.button.is-sky:hover, .button.is-sky.is-hovered { background-color: #0284c7; border-color: transparent; color: #fff; }

.button.is-indigo, .tag.is-indigo { background-color: #6366f1; border-color: transparent; color: #fff; }
.button.is-indigo:hover, .button.is-indigo.is-hovered { background-color: #4f46e5; border-color: transparent; color: #fff; }

.button.is-magenta, .tag.is-magenta { background-color: #d946ef; border-color: transparent; color: #fff; }
.button.is-magenta:hover, .button.is-magenta.is-hovered { background-color: #c026d3; border-color: transparent; color: #fff; }

.button.is-rose, .tag.is-rose { background-color: #f43f5e; border-color: transparent; color: #fff; }
.button.is-rose:hover, .button.is-rose.is-hovered { background-color: #e11d48; border-color: transparent; color: #fff; }

.button.is-slate, .tag.is-slate { background-color: #64748b; border-color: transparent; color: #fff; }
.button.is-slate:hover, .button.is-slate.is-hovered { background-color: #475569; border-color: transparent; color: #fff; }

.button.is-graphite, .tag.is-graphite { background-color: #374151; border-color: transparent; color: #fff; }
.button.is-graphite:hover, .button.is-graphite.is-hovered { background-color: #1f2937; border-color: transparent; color: #fff; }

.top-views-item:nth-child(2) .top-views-rank {
    background-color: #c0c0c0;
    color: #000;
}

.top-views-item:nth-child(3) .top-views-rank {
    background-color: #cd7f32;
    color: #fff;
}

/* Fix text overflow in Top Views */
.top-views-item .level-left {
    min-width: 0;
    flex: 1;
    display: flex;
}

.top-views-item .level-left .has-text-dark {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    width: 100%;
}

.top-views-item .level-right {
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.sidebar-column .box+.box {
    margin-top: 1.5rem;
}

.related-posts-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.related-post-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.related-post-item:last-child {
    border-bottom: none;
}

.related-post-item a {
    flex: 1;
    margin-right: 0.5rem;
    transition: color 0.2s ease;
}

.related-post-item a:hover {
    color: #3273dc !important;
}

/* External Links plugin: force left-aligned icon + text on all themes */
.external-link-button {
    display: flex;
    justify-content: flex-start !important;
    align-items: center;
    text-align: left !important;
    gap: 0.5rem;
}

.external-link-button .icon {
    flex: 0 0 auto;
}

.external-link-button__label {
    flex: 1 1 auto;
    text-align: left;
}

/* Pagination */
.pagination {
    margin-top: 2rem;
}

.pagination-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
}

.pagination-link {
    min-width: 2.5em;
    text-align: center;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .post-card {
        margin-bottom: 1.5rem !important;
    }

    .title.jant-post-card-title {
        font-size: 0.95rem !important;
    }

    article.post-content > h1.title.is-7 {
        font-size: 1.2rem !important;
    }

    .pagination-list {
        gap: 0.125rem;
    }

    .pagination-link {
        min-width: 2.25em;
        font-size: 0.875rem;
    }
}

/* Posts Grid Layout */
.posts-grid-layout {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.posts-grid-item {
    margin-bottom: 0 !important;
}

.posts-grid-item .post-thumbnail {
    margin-bottom: 1rem;
}

.posts-grid-item .post-thumbnail .image {
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.posts-grid-item .post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.posts-grid-item .title.is-4 {
    font-size: 1.25rem;
    line-height: 1.4;
}

.posts-grid-item .subtitle.is-6 {
    font-size: 0.875rem;
}

.posts-grid-item .content {
    font-size: 0.875rem;
    line-height: 1.6;
}

.posts-grid-item .level.is-mobile {
    margin-bottom: 0.75rem;
}

.posts-grid-item .tags {
    margin-bottom: 0.75rem;
}

.posts-grid-item .button {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

@media screen and (max-width: 1023px) {
    .posts-grid-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

@media screen and (max-width: 768px) {
    .posts-grid-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* =========================================
   Nested Dropdown Menu Support (Unlimited Levels)
   ========================================= */

/* 1. Container - Reset padding/margins for seamless nesting */
.navbar-item.has-dropdown.is-hoverable.is-nested {
    position: relative;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
}

/* 2. Link Styling - Ensure full width and proper colors */
.navbar-item.has-dropdown.is-hoverable.is-nested>.navbar-link {
    display: block;
    width: 100%;
    padding: 0.375rem 1rem;
    /* Standard dropdown item padding */
    padding-right: 1rem;
    /* Normal padding, arrow has its own margin */
    background-color: transparent !important;
    /* Default transparent */
    color: #4a4a4a !important;
    /* Default text color */
}

/* Hover/Active State - Match standard navbar hover style */
.navbar-item.has-dropdown.is-hoverable.is-nested:hover>.navbar-link,
.navbar-item.has-dropdown.is-hoverable.is-nested.is-active>.navbar-link {
    background-color: rgba(0, 0, 0, 0.05) !important;
    /* Light grey hover */
    color: #000000 !important;
    /* Black text on hover */
}

/* 3. Arrow Icon - Replace default arrow with inline FontAwesome Right Angle */
.navbar-item.has-dropdown.is-hoverable.is-nested>.navbar-link::after {
    border: none !important;
    content: "\f105" !important;
    /* fa-angle-right */
    font-family: "Font Awesome 5 Free" !important;
    font-weight: 900 !important;

    /* Inline positioning */
    display: inline-block !important;
    position: static !important;
    transform: none !important;
    margin-top: 0 !important;
    margin-left: 0.5em !important;
    /* Space after text */
    vertical-align: middle !important;

    /* Style */
    width: auto !important;
    height: auto !important;
    font-size: 1em !important;
    line-height: inherit !important;
    color: #b5b5b5 !important;
    /* Light grey arrow */
    pointer-events: none;
}

/* 4. Dropdown Position - Pop out to the right */
.navbar-item.has-dropdown.is-hoverable.is-nested>.navbar-dropdown {
    top: 0 !important;
    left: 100% !important;
    margin-top: -5px !important;
    margin-left: 0 !important;
    background-color: #fff;
    box-shadow: 0 8px 16px rgba(10, 10, 10, 0.1);
    z-index: 100;
    min-width: 200px;
}

/* 5. Visibility Logic - Fix overlapping issues */
/* Hide deep dropdowns by default */
.navbar-item.has-dropdown .navbar-dropdown .navbar-dropdown {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Show only immediate child dropdown on hover */
.navbar-item.has-dropdown.is-hoverable.is-nested:hover>.navbar-dropdown {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* =========================================
   Mobile Adjustments
   ========================================= */
@media screen and (max-width: 1023px) {

    /* Reset deep dropdowns for mobile toggle (if applicable) */
    .navbar-item.has-dropdown .navbar-dropdown .navbar-dropdown {
        display: none;
    }

    /* Allow active state to show children consistency */
    .navbar-item.has-dropdown.is-active .navbar-dropdown .navbar-dropdown {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* Stack nested items vertically on mobile */
    .navbar-item.has-dropdown.is-hoverable.is-nested>.navbar-dropdown {
        position: static !important;
        margin-left: 20px !important;
        top: auto !important;
        left: auto !important;
        box-shadow: none;
    }

    /* Reset arrow rotation for mobile if needed */
    .navbar-item.has-dropdown.is-hoverable.is-nested>.navbar-link::after {
        transform: rotate(0deg);
    }
}

/* 
   Fix Navbar Text Color for specific light themes 
   Themes: Cerulean, Flatly, Minty, Pulse, Sandstone
   Issue: These themes often have light navbar text which conflicts with our forced white navbar background.
*/
body.theme-cerulean .navbar.is-white .navbar-item,
body.theme-cerulean .navbar.is-white .navbar-link,
body.theme-flatly .navbar.is-white .navbar-item,
body.theme-flatly .navbar.is-white .navbar-link,
body.theme-minty .navbar.is-white .navbar-item,
body.theme-minty .navbar.is-white .navbar-link,
body.theme-pulse .navbar.is-white .navbar-item,
body.theme-pulse .navbar.is-white .navbar-link,
body.theme-sandstone .navbar.is-white .navbar-item,
body.theme-sandstone .navbar.is-white .navbar-link {
    color: #4a4a4a !important;
    /* Bulma's standard dark grey text color */
}

/* Ensure branding/logo text is also visible if it's text-based */
body.theme-cerulean .navbar.is-white .navbar-brand .navbar-item,
body.theme-flatly .navbar.is-white .navbar-brand .navbar-item,
body.theme-minty .navbar.is-white .navbar-brand .navbar-item,
body.theme-pulse .navbar.is-white .navbar-brand .navbar-item,
body.theme-sandstone .navbar.is-white .navbar-brand .navbar-item {
    color: #4a4a4a !important;
}

/* Maintain hover state visibility */
body.theme-cerulean .navbar.is-white .navbar-item:hover,
body.theme-cerulean .navbar.is-white .navbar-link:hover,
body.theme-minty .navbar.is-white .navbar-item:hover,
body.theme-minty .navbar.is-white .navbar-link:hover,
body.theme-pulse .navbar.is-white .navbar-item:hover,
body.theme-pulse .navbar.is-white .navbar-link:hover,
body.theme-sandstone .navbar.is-white .navbar-item:hover,
body.theme-sandstone .navbar.is-white .navbar-link:hover {
    color: #3273dc !important;
    /* Primary brand blue */
}

/* Flatly: custom link color */
body.theme-flatly .navbar.is-white .navbar-item:hover,
body.theme-flatly .navbar.is-white .navbar-link:hover {
    color: #5739a3 !important;
}

body.theme-flatly a:not(.button):not(.navbar-item):not(.navbar-link) {
    color: #5739a3;
}

body.theme-flatly a:not(.button):not(.navbar-item):not(.navbar-link):hover {
    color: #452c82;
}

/* 
   Font Overrides for Specific Themes
   Themes: Journal, Minty, Sandstone
   Font: Google Sarabun
*/
body.theme-journal,
body.theme-minty,
body.theme-sandstone {
    font-family: 'Sarabun', sans-serif !important;
}body.theme-journal h1,
body.theme-journal h2,
body.theme-journal h3,
body.theme-journal h4,
body.theme-journal h5,
body.theme-journal h6,
body.theme-journal .title,
body.theme-journal .subtitle,
body.theme-minty h1,
body.theme-minty h2,
body.theme-minty h3,
body.theme-minty h4,
body.theme-minty h5,
body.theme-minty h6,
body.theme-minty .title,
body.theme-minty .subtitle,
body.theme-sandstone h1,
body.theme-sandstone h2,
body.theme-sandstone h3,
body.theme-sandstone h4,
body.theme-sandstone h5,
body.theme-sandstone h6,
body.theme-sandstone .title,
body.theme-sandstone .subtitle {
    font-family: 'Kanit', sans-serif !important;
}

/* วิดเจ็ต Footer — เว้นข้างมาก บน–ล่างตามค่าเดิมก่อนขยาย */
.layout-footer-widget {
    padding: 1rem 2.5rem;
}

@media screen and (min-width: 769px) {
    .layout-footer-widget {
        padding: 1.25rem 3rem;
    }
}

/* โพสต์ล่าสุดใน footer — ไม่ใช้พื้นหลังกล่องสีขาว ตัวอักษรขาว (footer พื้นหลังเข้ม) */
.footer .latest-posts-widget--footer {
    background: transparent !important;
    box-shadow: none !important;
    border: none;
}

.footer .latest-posts-widget--footer .title {
    color: #ffffff !important;
}

.footer .latest-posts-widget--footer .title .fa-newspaper {
    color: rgba(255, 255, 255, 0.9) !important;
}

.footer .latest-posts-widget__link--footer {
    color: #ffffff !important;
}

.footer .latest-posts-widget__link--footer:hover {
    color: rgba(255, 255, 255, 0.88) !important;
    text-decoration: underline;
}

.footer .latest-posts-widget__meta--footer {
    color: rgba(255, 255, 255, 0.72) !important;
}

.footer .latest-posts-widget__empty--footer {
    color: rgba(255, 255, 255, 0.65) !important;
}
