/* Banner Slider */
.hero-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.hero-slider .slider-container {
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.hero-slider .slide {
    min-width: 100%;
}

.hero-slider .slide img {
    width: 100%;
    height: clamp(240px, 38vw, 440px);
    display: block;
    object-fit: cover;
    object-position: center;
}

.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.4);
    color: white;
    border: none;
    padding: 12px 18px;
    cursor: pointer;
    font-size: 24px;
    border-radius: 50%;
    z-index: 10;
    transition: background 0.3s;
}

.slider-btn.prev {
    left: 20px;
}

.slider-btn.next {
    right: 20px;
}

.slider-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.slider-dots {
    position: absolute;
    bottom: 20px;
    width: 100%;
    text-align: center;
}

.dot {
    cursor: pointer;
    height: 15px;
    width: 15px;
    margin: 0 5px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    display: inline-block;
    transition: background-color 0.3s ease;
}

.dot.active,
.dot:hover {
    background-color: white;
}

/* Home News Section */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 1.25rem;
}

.news-month {
    margin-top: 2.5rem;
    text-align: left;
}

.news-month h3 {
    margin: 0;
    color: #244936;
    font-size: 1.6rem;
}

.news-facebook-link {
    margin-top: 2.5rem;
    text-align: center;
}

.news-facebook-link a {
    color: #2E8B57;
    font-weight: bold;
    text-decoration: none;
}

.news-facebook-link a:hover {
    text-decoration: underline;
}

.news-item {
    background: #fff;
    border: 1px solid #eaeaea;
    padding: 2rem;
    border-radius: 12px;
    text-align: left;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.04);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.news-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

.news-item h3,
.news-item h4 {
    margin-top: 0;
    color: #2E8B57;
    font-size: 1.25rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.news-item p {
    color: #555;
    margin-bottom: 1.5rem;
}

.news-item .read-more-link {
    margin-top: auto;
    align-self: flex-start;
    color: #2E8B57;
    text-decoration: none;
    font-weight: bold;
}

.news-item .read-more-link:hover {
    text-decoration: underline;
}

/* Gallery Section */
#gallery {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(214, 233, 222, 0.88) 0%, rgba(248, 252, 249, 0.78) 48%, rgba(198, 224, 209, 0.86) 100%),
        url('../images/รูปมูลนิธิ_3.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.gallery-container {
    position: relative;
    z-index: 1;
    max-width: 1120px;
}

.gallery-heading {
    max-width: 720px;
    margin: 0 auto 2rem;
}

.gallery-heading h2 {
    margin-bottom: 1rem;
}

.gallery-heading p {
    margin: 0;
    color: #2e4036;
    font-size: 1.12rem;
    line-height: 1.6;
}

.gallery-slider {
    overflow: hidden;
    width: 100%;
    touch-action: pan-y;
}

.gallery-slider-track {
    display: flex;
    transition: transform 0.45s ease;
    will-change: transform;
}

.gallery-slide {
    min-width: 100%;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: 150px;
    grid-auto-flow: dense;
    gap: 1rem;
}

.gallery-grid-balanced {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 240px;
    max-width: 900px;
    margin: 0 auto;
}

.gallery-grid-mixed {
    grid-template-columns: 0.85fr 1fr 1fr;
    grid-template-rows: repeat(2, 240px);
    max-width: 900px;
    margin: 0 auto;
}

.gallery-grid-mixed .gallery-photo-portrait {
    grid-row: span 2;
}

.gallery-grid-mixed .gallery-photo:last-child {
    grid-column: 2 / span 2;
}

.gallery-photo {
    position: relative;
    overflow: hidden;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #dfe8e3;
    cursor: pointer;
    box-shadow: 0 12px 26px rgba(31, 72, 52, 0.08);
}

.gallery-photo img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    transition: transform 0.35s ease, filter 0.35s ease;
}

.gallery-photo::after {
    content: '+';
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(20, 55, 36, 0.36);
    color: #fff;
    font-size: 2.8rem;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.gallery-photo:hover img,
.gallery-photo:focus-visible img {
    transform: scale(1.04);
    filter: saturate(1.05);
}

.gallery-photo:hover::after,
.gallery-photo:focus-visible::after {
    opacity: 1;
}

.gallery-photo:focus-visible {
    outline: 3px solid rgba(46, 139, 87, 0.45);
    outline-offset: 3px;
}

.gallery-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.gallery-nav {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: #2E8B57;
    color: #fff;
    cursor: pointer;
    font-size: 1.3rem;
    line-height: 1;
    transition: background 0.25s ease, transform 0.25s ease;
}

.gallery-nav:hover,
.gallery-nav:focus-visible {
    background: #246b44;
    transform: translateY(-1px);
}

.gallery-dots {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.gallery-dot {
    width: 11px;
    height: 11px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(46, 139, 87, 0.28);
    cursor: pointer;
    transition: background 0.25s ease, transform 0.25s ease;
}

.gallery-dot.active,
.gallery-dot:hover,
.gallery-dot:focus-visible {
    background: #2E8B57;
    transform: scale(1.15);
}

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(18, 28, 23, 0.86);
}

.gallery-lightbox.is-open {
    display: flex;
}

.gallery-lightbox-image {
    max-width: min(92vw, 1100px);
    max-height: 86vh;
    border-radius: 8px;
    object-fit: contain;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
}

.gallery-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #1f4f35;
    cursor: pointer;
    font-size: 2rem;
    line-height: 1;
}

.gallery-lightbox-close:hover,
.gallery-lightbox-close:focus-visible {
    background: #fff;
}

@media (max-width: 900px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 180px;
    }

    .gallery-grid-balanced {
        grid-auto-rows: 190px;
    }

    .gallery-grid-mixed {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: none;
        grid-auto-rows: 190px;
    }

    .gallery-grid-mixed .gallery-photo-portrait,
    .gallery-grid-mixed .gallery-photo:last-child {
        grid-column: auto;
        grid-row: auto;
    }
}

@media (max-width: 560px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: 220px;
    }

    .gallery-grid-balanced {
        grid-auto-rows: 220px;
    }

    .gallery-grid-mixed {
        grid-template-columns: 1fr;
        grid-auto-rows: 220px;
    }
}
