/* =========================================================
   NEWS PAGE
   ทีมอาสาพัฒนาไทย
   Theme: Navy + Green
========================================================= */

.news {
    padding: 0 0 90px;
    background: #f5f7fa;
}

.news .container {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
}


/* =========================================================
   NEWS HEADER
========================================================= */

.news h2 {
    position: relative;

    margin: 0 0 35px;
    padding-bottom: 16px;

    color: #093a6e;

    font-size: clamp(28px, 4vw, 38px);
    font-weight: 800;
    line-height: 1.4;
}

.news h2::after {
    content: "";

    position: absolute;
    left: 0;
    bottom: 0;

    width: 65px;
    height: 4px;

    border-radius: 999px;

    background: linear-gradient(
        90deg,
        #093a6e,
        #60cb30
    );
}


/* =========================================================
   NEWS GRID
========================================================= */

.news-grid {
    display: grid;

    grid-template-columns: repeat(3, minmax(0, 1fr));

    gap: 24px;

    align-items: stretch;
}


/* =========================================================
   NEWS CARD
========================================================= */

.troubleshooting-card {
    display: flex;
    flex-direction: column;

    min-width: 0;
    overflow: hidden;

    background: #ffffff;

    border: 1px solid #e2e8ee;
    border-radius: 18px;

    box-shadow:
        0 5px 18px rgba(9, 58, 110, 0.06);

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease,
        border-color 0.25s ease;
}

.troubleshooting-card:hover {
    transform: translateY(-6px);

    border-color: rgba(9, 58, 110, 0.15);

    box-shadow:
        0 18px 40px rgba(9, 58, 110, 0.13);
}


/* =========================================================
   NEWS IMAGE
========================================================= */

.news-image {
    position: relative;

    width: 100%;
    aspect-ratio: 16 / 9;

    overflow: hidden;

    background:
        linear-gradient(
            135deg,
            #eef3f7,
            #e7f2e2
        );
}

.news-image::after {
    content: "";

    position: absolute;
    inset: 0;

    background:
        linear-gradient(
            to bottom,
            rgba(9, 58, 110, 0),
            rgba(9, 58, 110, 0.08)
        );

    pointer-events: none;
}

.news-image img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;

    transition:
        transform 0.45s ease;
}

.troubleshooting-card:hover .news-image img {
    transform: scale(1.045);
}


/* =========================================================
   NEWS CONTENT
========================================================= */

.news-content {
    display: flex;
    flex-direction: column;
    flex: 1;

    padding: 22px 22px 21px;
}


/* =========================================================
   NEWS TITLE
========================================================= */

.news-content h3 {
    margin: 0 0 10px;

    color: #093a6e;

    font-size: 19px;
    font-weight: 800;
    line-height: 1.55;

    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;

    overflow: hidden;
}


/* =========================================================
   NEWS DETAILS
========================================================= */

.news-content > p:not(:has(.status)) {
    margin: 0;

    color: #718091;

    font-size: 13px;
    line-height: 1.7;

    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;

    overflow: hidden;
}


/* =========================================================
   STATUS
========================================================= */

.news-content .status {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    width: fit-content;

    margin-top: 15px;
    padding: 5px 10px;

    border-radius: 999px;

    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
}

/* จุดวงกลมหน้าสถานะ */

.news-content .status::before {
    content: "";

    width: 7px;
    height: 7px;

    flex-shrink: 0;

    border-radius: 50%;
}


/* =========================================================
   STATUS - GREEN
========================================================= */

.status--green {
    color: #28751a;

    background: #edf9e9;

    border: 1px solid #ccebc4;
}

.status--green::before {
    background: #60cb30;
}


/* =========================================================
   STATUS - YELLOW
========================================================= */

.status--yellow {
    color: #806500;

    background: #fff9df;

    border: 1px solid #f0df98;
}

.status--yellow::before {
    background: #e5bd24;
}


/* =========================================================
   STATUS - RED
========================================================= */

.status--red {
    color: #a53b3b;

    background: #fff0f0;

    border: 1px solid #f0cccc;
}

.status--red::before {
    background: #d84b4b;
}


/* =========================================================
   READ MORE
========================================================= */

.news-content .read-more {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;

    width: 100%;

    margin-top: auto;
    padding-top: 18px;

    color: #093a6e;

    border-top: 1px solid #edf0f3;

    font-size: 14px;
    font-weight: 700;

    transition:
        color 0.2s ease,
        padding-left 0.2s ease;
}

.news-content .read-more::after {
    content: "→";

    color: #60cb30;

    font-size: 18px;
    line-height: 1;

    transition:
        transform 0.2s ease;
}

.news-content .read-more:hover {
    color: #60cb30;
    padding-left: 3px;
}

.news-content .read-more:hover::after {
    transform: translateX(4px);
}


/* =========================================================
   LOADING / EMPTY / ERROR
   JS สร้าง div เปล่าขึ้นมาโดยไม่มี class
========================================================= */

.news-grid > div:not(.troubleshooting-card) {
    grid-column: 1 / -1;

    min-height: 180px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 30px;

    color: #718091;

    background: #ffffff;

    border: 1px dashed #ccd6df;
    border-radius: 16px;

    font-size: 15px;
    font-weight: 600;
}


/* =========================================================
   LOADING ANIMATION
========================================================= */

.news-grid > div:not(.troubleshooting-card)::after {
    content: "";

    width: 17px;
    height: 17px;

    margin-left: 10px;

    border: 2px solid #dce4eb;
    border-top-color: #093a6e;

    border-radius: 50%;

    animation: newsLoading 0.75s linear infinite;
}

@keyframes newsLoading {
    to {
        transform: rotate(360deg);
    }
}


/* =========================================================
   CARD ANIMATION
========================================================= */

.troubleshooting-card.animate-in {
    animation: newsCardIn 0.45s ease both;
}

@keyframes newsCardIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* =========================================================
   TABLET
========================================================= */

@media (max-width: 950px) {

    .news-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }

    .news-content {
        padding: 20px;
    }

}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 650px) {

    .news {
        padding-bottom: 65px;
    }

    .news .container {
        width: calc(100% - 24px);
    }

    .news h2 {
        margin-bottom: 25px;

        font-size: 27px;
    }

    .news-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .troubleshooting-card {
        border-radius: 15px;
    }

    .news-image {
        aspect-ratio: 16 / 9;
    }

    .news-content {
        padding: 18px 18px 19px;
    }

    .news-content h3 {
        font-size: 18px;
    }

}


/* =========================================================
   SMALL MOBILE
========================================================= */

@media (max-width: 420px) {

    .news .container {
        width: calc(100% - 20px);
    }

    .news h2 {
        font-size: 24px;
    }

    .news-content h3 {
        font-size: 17px;
    }

    .news-content > p:not(:has(.status)) {
        font-size: 12px;
    }

    .news-content .read-more {
        font-size: 13px;
    }

}
section.news {
    margin-top: 20px;
}

main.main-container {
    background: #f5f7fa;
}
