/* ==========================================================================
   Blog & News Page Stylesheet (sunway_goweb)
   Conforms to goweb-layout-views responsive guidelines (rem root, em component)
   Uses root color tokens from style.css
   ========================================================================== */

.news_page {
    font-size: 1rem;
    background-color: var(--neutral-1);
}

/* ==========================================================================
   1. Banner Section (Ratio 1440 x 480)
   ========================================================================== */
.news_banner {
    position: relative;
    font-size: 1rem;
    width: 100%;
    aspect-ratio: 144 / 48;
    overflow: hidden;
    background-color: var(--secondary-6);
    margin-bottom: 2.4em;
}

.news_banner picture {
    display: block;
    width: 100%;
    height: 100%;
}

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

.news_banner_inner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
}

.news_banner_content {
    max-width: 52%;
    display: flex;
    flex-direction: column;
    gap: 1.2em;
}

.news_banner_title {
    font-size: 6.2em;
    font-weight: 600;
    line-height: 1.15;
    color: var(--brand-3);
}

.news_banner_desc {
    font-size: 2em;
    font-weight: 400;
    line-height: 1.45;
    color: var(--neutral-12);
}

/* ==========================================================================
   2. Main Container & Head (Sort & Counter)
   ========================================================================== */
.news_container {
    font-size: 1rem;
}

.news_head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1em;
    padding-bottom: 0.4em;
}

.news_count {
    font-size: 1.5em;
    color: var(--neutral-4);
    font-weight: 400;
    margin: 0;
}

.news_sort {
    display: flex;
    align-items: center;
    gap: 1.2em;
}

.news_sort label {
    font-size: 1.5em;
    color: var(--neutral-6);
    font-weight: 500;
}

.news_sort_select_wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.news_sort_select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--neutral-1);
    border: 1px solid var(--neutral-7);
    border-radius: 0.8em;
    padding: 0.7em 3.2em 0.7em 1.4em;
    font-size: 1.2em;
    font-weight: 400;
    color: var(--neutral-6);
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.news_sort_select:focus {
    border-color: var(--brand-1);
    box-shadow: 0 0 0 2px rgba(0, 110, 69, 0.12);
}

.news_sort_arrow {
    position: absolute;
    right: 1.2em;
    width: 1.2em;
    height: 1.2em;
    color: var(--neutral-4);
    pointer-events: none;
}

/* ==========================================================================
   3. News Grid & Card
   ========================================================================== */
.news_grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2.4em;
}

.news_grid:has(+ div:empty) {
    padding-bottom: 2.4em;
}

/* htmx loading state */
.news_results {
    transition: opacity 0.2s ease;
}

.news_results.htmx-request {
    opacity: 0.5;
    pointer-events: none;
}

/* ==========================================================================
   4. Article Card (.news)
   ========================================================================== */
.news {
    font-size: 1rem;
    background-color: var(--neutral-1);
    border: 1px solid var(--neutral-7);
    border-radius: 1.6em;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0.2em 1.2em rgba(0, 0, 0, 0.03);
    transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
}

.news:hover {
    transform: translateY(-0.4em);
    box-shadow: 0 1.2em 3em rgba(0, 0, 0, 0.08);
    border-color: var(--neutral-11);
}

.news_media {
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background-color: var(--neutral-14);
    display: block;
    text-decoration: none;
}

.news_media_img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.news:hover .news_media_img {
    transform: scale(1.04);
}

.news_info {
    padding: 1.6em 1.6em 1.6em;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 1.2em;
}

/* Date */
.news_date {
    display: flex;
    align-items: center;
    gap: 0.8em;
    color: var(--neutral-4);
}

.news_date>svg {
    width: 1.6em;
    height: 1.6em;
    color: var(--neutral-4);
    flex-shrink: 0;
}

.news_date>time {
    font-size: 1.4em;
    color: var(--neutral-4);
    font-weight: 400;
    line-height: 1;
}

.news_content {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

/* Title */
.news_title {
    font-size: 1.6em;
    font-weight: 600;
    margin: 0;
}

.news_title>a {
    color: var(--secondary-8);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s ease;
}

.news_title>a:hover {
    color: var(--brand-3);
}

/* Description / Excerpt */
.news_des {
    font-size: 1.4em;
    font-weight: 400;
    line-height: 1.5;
    color: var(--neutral-12);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.news_des p {
    margin: 0;
    display: inline;
}

/* Read More */
.news_link {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.6em;
    color: var(--brand-1);
    text-decoration: none;
    width: fit-content;
    transition: color 0.2s ease;
}

.news_link>span {
    font-size: 1.4em;
    font-weight: 500;
    color: inherit;
    transition: color 0.2s ease;
}

.news_link>svg {
    width: 1.1em;
    height: 1.1em;
    color: inherit;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.news_link:hover {
    color: var(--brand-3);
}

.news_link:hover>svg {
    transform: translateX(0.35em);
}

/* ==========================================================================
   5. Responsive Adjustments
   ========================================================================== */
@media (max-width: 1199px) {
    .news_banner_content {
        max-width: 54%;
    }

    .news_banner_title {
        font-size: 5.2em;
    }

    .news_banner_desc {
        font-size: 1.8em;
    }
}

@media (max-width: 991px) {
    .news_banner {
        aspect-ratio: 16 / 6;
        min-height: 18em;
        margin-bottom: 2em;
    }

    .news_banner_content {
        max-width: 56%;
        gap: 1em;
    }

    .news_banner_title {
        font-size: 3.8em;
    }

    .news_banner_desc {
        font-size: 1.5em;
    }

    .news_grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 2.2em;
    }

    .news_container,
    .news {
        font-size: 0.8rem;
    }
}

@media (max-width: 767px) {
    .news_banner {
        aspect-ratio: 16 / 8;
        min-height: 16em;
        margin-bottom: 1.8em;
    }

    .news_banner_img {
        object-position: 80% center;
    }

    .news_banner_content {
        max-width: 62%;
        gap: 0.8em;
    }

    .news_banner_title {
        font-size: clamp(2.2em, 5.5vw, 3.2em);
    }

    .news_banner_desc {
        font-size: clamp(1.2em, 2.8vw, 1.4em);
        line-height: 1.4;
    }

    .news_banner_desc br {
        display: none;
    }
}

@media (max-width: 576px) {
    .news_banner {
        aspect-ratio: 16 / 9;
        min-height: 14em;
        margin-bottom: 1.6em;
    }

    .news_banner_img {
        object-position: 85% center;
    }

    .news_banner_content {
        max-width: 70%;
        gap: 0.6em;
    }

    .news_banner_title {
        font-size: clamp(2em, 6.5vw, 2.6em);
    }

    .news_banner_desc {
        font-size: 1.25em;
    }

    .news_head {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.2em;
        margin-bottom: 2em;
    }

    .news_grid {
        grid-template-columns: 1fr;
        gap: 1.8em;
    }

    .news_info {
        padding: 1.6em;
    }

    .news_container,
    .news {
        font-size: 0.9rem;
    }
}

/* ==========================================================================
   6. News Detail Page
   ========================================================================== */
.news_detail_page {
    font-size: 1rem;
    padding-top: 2.4em;
}

.news_detail_wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1fr) calc(33.2em + 2px);
    gap: 2.4em;
    align-items: start;
    padding-bottom: 1.6em;
}

.news_detail_main {
    min-width: 0;
}

/* Title (32px) */
.news_detail_title {
    font-size: 3.2em;
    font-weight: 600;
    color: var(--secondary-8);
    margin-bottom: 0.5em;
}

/* Date (14px) */
.news_detail_date {
    display: flex;
    align-items: center;
    gap: 0.8em;
    margin-bottom: 2em;
    color: var(--neutral-4);
}

.news_detail_date>svg {
    width: 1.6em;
    height: 1.6em;
    color: var(--neutral-4);
    flex-shrink: 0;
}

.news_detail_date>time {
    font-size: 1.4em;
    color: var(--neutral-4);
    font-weight: 400;
}

/* Rich Text Contents (Base font 14px) */
.news_detail_contents {
    font-size: 1rem;
    color: var(--neutral-12);
}

.news_detail_contents p {
    font-size: 1.4em;
    color: var(--neutral-12);
    margin-bottom: 0.5em;
}

.news_detail_contents p:last-child {
    margin-bottom: 0;
}

/* Headings within Content */
.news_detail_contents h2 {
    font-size: 2.4em;
    font-weight: 500;
    color: var(--secondary-8);
    margin-bottom: 0.5em;
}

.news_detail_contents h3 {
    font-size: 2.0em;
    font-weight: 600;
    color: var(--secondary-8);
    margin-bottom: 0.5em;
}

.news_detail_contents h4 {
    font-size: 1.7em;
    font-weight: 600;
    color: var(--secondary-8);
    margin-bottom: 0.5em;
}

.news_detail_contents h5,
.news_detail_contents h6 {
    font-size: 1.5em;
    font-weight: 600;
    color: var(--secondary-8);
    margin-bottom: 0.5em;
}

/* Lists */
.news_detail_contents ul,
.news_detail_contents ol {
    font-size: 1.4em;
    color: var(--neutral-12);
    margin-bottom: 0.5em;
    padding-left: 2em;
}

.news_detail_contents ul {
    list-style-type: disc;
}

.news_detail_contents ol {
    list-style-type: decimal;
}

.news_detail_contents li:last-child {
    margin-bottom: 0;
}

/* Images & Media */
.news_detail_contents img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 1.2em;
    margin: 2em auto;
    object-fit: cover;
}

.news_detail_contents figure {
    margin: 2em auto;
    text-align: center;
}

.news_detail_contents figure img {
    margin: 0 auto;
}

.news_detail_contents figcaption {
    font-size: 1.2em;
    color: var(--neutral-4);
    text-align: center;
    margin-top: 0.8em;
    font-style: italic;
}

/* Blockquote */
.news_detail_contents blockquote {
    font-size: 1.4em;
    line-height: 1.75;
    border-left: 0.35em solid var(--brand-1);
    background-color: var(--secondary-9);
    padding: 1.2em 1.6em;
    margin: 1.8em 0;
    border-radius: 0 0.8em 0.8em 0;
    color: var(--neutral-6);
    font-style: italic;
}

.news_detail_contents blockquote p {
    font-size: 1em;
    margin: 0;
}

/* Links */
.news_detail_contents a {
    color: var(--brand-1);
    text-decoration: underline;
    transition: color 0.2s ease;
}

.news_detail_contents a:hover {
    color: var(--brand-3);
}

/* Strong / Bold */
.news_detail_contents strong,
.news_detail_contents b {
    font-weight: 600;
    color: var(--neutral-9);
}

/* Tables */
.news_detail_contents table {
    width: 100%;
    font-size: 1.4em;
    border-collapse: collapse;
    margin: 1.8em 0;
    border-radius: 0.8em;
    overflow: hidden;
}

.news_detail_contents table th,
.news_detail_contents table td {
    padding: 0.9em 1.2em;
    border: 1px solid var(--neutral-7);
    text-align: left;
}

.news_detail_contents table th {
    background-color: var(--neutral-14);
    color: var(--secondary-8);
    font-weight: 600;
}

/* Code & Pre */
.news_detail_contents code {
    background-color: var(--neutral-14);
    padding: 0.2em 0.5em;
    border-radius: 0.4em;
    font-size: 1.3em;
    font-family: monospace;
    color: var(--brand-3);
}

.news_detail_contents pre {
    background-color: var(--neutral-14);
    padding: 1.2em;
    border-radius: 0.8em;
    overflow-x: auto;
    margin: 1.6em 0;
}

.news_detail_contents pre code {
    padding: 0;
    background-color: transparent;
}

/* Horizontal Rule */
.news_detail_contents hr {
    border: none;
    border-top: 1px solid var(--neutral-7);
    margin: 2.4em 0;
}

/* Video & Iframe */
.news_detail_contents iframe,
.news_detail_contents video {
    max-width: 100%;
    border-radius: 1.2em;
    margin: 1.8em 0;
    display: block;
}

.news_detail_sidebar {
    width: 100%;
    padding: 1.6em;
}

.news_detail_sidebar_title {
    font-size: 2em;
    color: var(--secondary-4);
    font-weight: 600;
    margin-bottom: 0.7em;
}

.news_detail_related {
    font-size: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.6em;
}

/* ==========================================================================
   Share Article Bar (Dashed Top/Bottom Border)
   ========================================================================== */
.news_detail_share {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.6em 0;
    margin: 3.2em 0 2em;
    background-image:
        linear-gradient(to right, var(--neutral-7) 50%, transparent 50%),
        linear-gradient(to right, var(--neutral-7) 50%, transparent 50%);
    background-position: top, bottom;
    background-size: 1em 1px, 1em 1px;
    background-repeat: repeat-x, repeat-x;
}

.news_share_label {
    font-size: 1.5em;
    font-weight: 500;
    color: var(--neutral-9);
}

.news_share_links {
    display: flex;
    align-items: center;
    gap: 1.6em;
    color: var(--brand-1);
}

.news_share_links>a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-1);
    text-decoration: none;
    transition: color 0.25s ease, transform 0.25s ease;
}

.news_share_links>a:hover {
    color: var(--brand-3);
    transform: translateY(-0.15em);
}

.news_share_links>a>svg {
    width: 2em;
    height: 2em;
    fill: currentColor;
    display: block;
}


/* ==========================================================================
   7. News Detail Responsive
   ========================================================================== */
@media (max-width: 991px) {
    .news_detail_wrapper {
        grid-template-columns: 1fr;
        gap: 2.4em;
        padding-bottom: 4em;
    }

    .news_detail_sidebar {
        width: 100%;
        padding: 0;
    }

    .news_detail_title {
        font-size: 2.6em;
    }
}


@media (max-width: 576px) {
    .news_detail_page {
        padding-top: 1.6em;
    }

    .news_detail_title {
        font-size: clamp(2em, 5.5vw, 2.4em);
    }

    .news_detail_contents h2 {
        font-size: 2em;
    }

    .news_detail_contents h3 {
        font-size: 1.8em;
    }

    .news_detail_share {
        padding: 1.4em 0;
        margin: 2.4em 0 1.6em;
    }

    .news_share_label {
        font-size: 1.4em;
    }

    .news_share_links {
        gap: 1.3em;
    }

    .news_share_links>a>svg {
        width: 1.8em;
        height: 1.8em;
    }

}