/* Gallery tabs (js/gallery-tabs.js) — รูปทุก panel อยู่ใน grid เดียวกัน
   เพื่อให้ tab "All" เรียงต่อเนื่องไม่มีช่องว่างระหว่างกลุ่ม */

.lw-gallery-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin: 0 0 100px; /* เท่ากับ spacer ใต้ gallery แบบเดิมในหน้าอื่น */
    padding: 0 !important; /* Astra ใส่ padding ให้ group block */
}

.lw-gallery-tabs>.lw-tab-panel,
.lw-gallery-tabs .lw-tab-panel>.wp-block-gallery {
    display: contents;
}

.lw-gallery-tabs>.lw-tab-panel[hidden] {
    display: none;
}

.lw-gallery-tabs .lw-tab-label {
    display: none;
}

.lw-gallery-tabs .wp-block-gallery>.wp-block-image {
    width: auto !important;
    margin: 0 !important;
    aspect-ratio: 1;
}

.lw-gallery-tabs .wp-block-gallery>.wp-block-image img {
    width: 100%;
    height: 100% !important;
    object-fit: cover;
}

/* แถบ tab */
.lw-tabs-nav {
    grid-column: 1 / -1;
    display: flex;
    margin-bottom: 16px;
    box-shadow: inset 0 -1px 0 #e2e2e3; /* เส้นใต้แถบ tab (ไม่ใช้ margin ติดลบ ซึ่งทำให้เลื่อนแนวตั้งได้ 1px) */
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}

.lw-tabs-nav::-webkit-scrollbar {
    display: none;
}

.lw-gallery-tabs .lw-tab {
    flex: 0 0 auto;
    min-width: 130px;
    margin: 0;
    padding: 12px 20px;
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    color: #6d6e71;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;
    transition: color .2s ease, border-color .2s ease;
}

.lw-gallery-tabs .lw-tab:hover,
.lw-gallery-tabs .lw-tab:focus-visible {
    background: none;
    color: #4b4c4f;
}

.lw-gallery-tabs .lw-tab[aria-selected="true"] {
    border-bottom-color: #4b4c4f;
    color: #4b4c4f;
    font-weight: 600;
}

@media (max-width: 1024px) {
    .lw-gallery-tabs {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

@media (max-width: 767px) {
    .lw-gallery-tabs {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .lw-gallery-tabs .lw-tab {
        min-width: 0;
        padding: 12px 16px;
        font-size: 15px;
    }
}
