/* ======================================================
   NewsBuilder Plus Home
   헤드라인 전체폭 + 하단 좌우 분할 구조
   ====================================================== */

.nb-plus-home {
    --nb-ink: #111827;
    --nb-sub: #334155;
    --nb-muted: #64748b;
    --nb-soft: #f3f4f6;
    --nb-card: #ffffff;
    --nb-line: #e5e7eb;
    --nb-black: #15161b;
    --nb-red: #ef3b2d;
    --nb-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);

    width: 100%;
    max-width: 920px;
    margin: 0 auto 90px;
    padding: 0 18px;
    color: var(--nb-ink);
}

/* ======================================================
   Full width headline
   ====================================================== */

.nb-headline-wide {
    width: 100%;
    margin-bottom: 14px;
}

.nb-headline-card {
    position: relative;
    overflow: hidden;
    min-height: 292px;
    border-radius: 16px;
    background: #22252d;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
}

.nb-headline-image {
    position: absolute;
    inset: 0;
    display: block;
    background: #1f2937;
}

.nb-headline-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1.01);
}

.nb-headline-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.34) 55%, rgba(0, 0, 0, 0.08)),
        linear-gradient(0deg, rgba(0, 0, 0, 0.18), transparent 48%);
}

.nb-headline-overlay {
    position: relative;
    z-index: 2;
    width: 56%;
    min-height: 292px;
    padding: 32px 34px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.nb-headline-overlay h2 {
    margin: 0;
    color: #ffffff;
    font-size: 36px;
    line-height: 1.12;
    letter-spacing: -0.08em;
    font-weight: 1000;
}

.nb-headline-overlay h2 a {
    color: #ffffff;
    text-decoration: none;
}

.nb-headline-overlay p {
    margin: 12px 0 0;
    color: rgba(255, 255, 255, 0.86);
    font-size: 15px;
    line-height: 1.55;
    word-break: keep-all;
}

.nb-headline-empty {
    min-height: 230px;
    border: 1px dashed #cbd5e1;
    border-radius: 16px;
    background: #ffffff;
    display: grid;
    place-items: center;
    text-align: center;
}

.nb-headline-empty strong {
    display: block;
    margin-bottom: 8px;
    font-size: 28px;
    letter-spacing: -0.06em;
}

/* ======================================================
   Issue line
   ====================================================== */

.nb-issue-line {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 24px;
    padding: 12px 16px;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: var(--nb-shadow);
    color: var(--nb-muted);
    font-size: 13px;
    line-height: 1.4;
}

.nb-issue-line span {
    color: var(--nb-red);
    font-size: 12px;
    letter-spacing: 0.04em;
    font-weight: 1000;
}

.nb-issue-line strong {
    color: var(--nb-ink);
    font-weight: 900;
}

/* ======================================================
   Main split
   ====================================================== */

.nb-main-split {
    display: grid;
    grid-template-columns: minmax(0, 620px) 260px;
    gap: 28px;
    align-items: start;
}

.nb-main-content {
    min-width: 0;
}

.nb-side-content {
    position: sticky;
    top: 24px;
    display: grid;
    gap: 14px;
}

/* ======================================================
   Common
   ====================================================== */

.nb-block,
.nb-section-wide,
.nb-side-box,
.nb-side-guide {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: var(--nb-shadow);
}

.nb-block,
.nb-section-wide {
    margin-bottom: 28px;
    padding: 20px;
}

.nb-block-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.nb-block-head-line {
    padding-bottom: 10px;
    border-bottom: 2px solid #111827;
}

.nb-block-head h2 {
    margin: 0;
    color: var(--nb-ink);
    font-size: 19px;
    line-height: 1.25;
    letter-spacing: -0.06em;
    font-weight: 1000;
}

.nb-block-head h2::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 16px;
    margin-right: 8px;
    border-radius: 999px;
    background: var(--nb-red);
    vertical-align: -2px;
}

.nb-block-head a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 12px;
    font-weight: 900;
}

.nb-block-head a:hover {
    color: var(--nb-red);
}

.nb-pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 1000;
}

.nb-pill-red {
    padding: 5px 10px;
    margin-bottom: 10px;
    background: var(--nb-red);
    color: #ffffff;
    font-size: 12px;
}

.nb-pill-small {
    padding: 3px 8px;
    margin-bottom: 7px;
    background: var(--nb-red);
    color: #ffffff;
    font-size: 11px;
}

.nb-meta {
    margin-top: 9px;
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.4;
    font-weight: 800;
}

.nb-meta-light {
    color: rgba(255, 255, 255, 0.72);
}

.nb-meta-card {
    color: rgba(255, 255, 255, 0.68);
    font-size: 11px;
}

/* ======================================================
   Card grid
   ====================================================== */

.nb-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.nb-news-card {
    position: relative;
    overflow: hidden;
    min-height: 230px;
    border-radius: 14px;
    background: #111827;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}

.nb-news-card-image {
    position: absolute;
    inset: 0;
    display: block;
    background: linear-gradient(135deg, #111827, #334155);
    color: #ffffff;
    text-decoration: none;
}

.nb-news-card-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.86), rgba(0, 0, 0, 0.18) 58%, rgba(0, 0, 0, 0.04));
}

.nb-news-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.24s ease;
}

.nb-news-card:hover .nb-news-card-image img {
    transform: scale(1.035);
}

.nb-news-card-image span {
    position: relative;
    z-index: 2;
    height: 100%;
    display: grid;
    place-items: center;
    padding: 14px;
    text-align: center;
    font-weight: 1000;
}

.nb-news-card-body {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    padding: 14px 14px 15px;
    color: #ffffff;
}

.nb-news-card h3 {
    margin: 0;
    font-size: 15.5px;
    line-height: 1.35;
    letter-spacing: -0.055em;
    font-weight: 1000;
}

.nb-news-card h3 a {
    color: #ffffff;
    text-decoration: none;
}

/* ======================================================
   Two shot
   ====================================================== */

.nb-two-shot-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.nb-shot-box {
    padding: 16px;
    border: 1px solid var(--nb-line);
    border-radius: 14px;
    background: #f8fafc;
}

.nb-shot-box h3 {
    margin: 0 0 10px;
    color: var(--nb-ink);
    font-size: 15px;
    letter-spacing: -0.04em;
    font-weight: 1000;
}

.nb-shot-box ul,
.nb-side-news-list,
.nb-category-box ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.nb-shot-box li,
.nb-side-news-list li,
.nb-category-box li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--nb-line);
}

.nb-shot-box li:last-child,
.nb-side-news-list li:last-child,
.nb-category-box li:last-child {
    border-bottom: 0;
}

.nb-shot-box a,
.nb-side-news-list a,
.nb-category-box a,
.nb-popular-grid a,
.nb-rank-list a {
    color: var(--nb-ink);
    text-decoration: none;
    font-weight: 900;
    line-height: 1.42;
}

.nb-shot-box a:hover,
.nb-side-news-list a:hover,
.nb-category-box a:hover,
.nb-popular-grid a:hover,
.nb-rank-list a:hover {
    color: var(--nb-red);
}

.nb-shot-box span,
.nb-side-news-list span {
    flex: 0 0 auto;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 800;
}

/* ======================================================
   Category section
   ====================================================== */

.nb-category-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.nb-category-box {
    padding: 15px;
    border: 1px solid var(--nb-line);
    border-radius: 14px;
    background: #ffffff;
}

.nb-category-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 9px;
}

.nb-category-head h3 {
    margin: 0;
    color: var(--nb-ink);
    font-size: 15px;
    font-weight: 1000;
}

.nb-category-head a {
    color: #94a3b8;
    font-size: 11px;
    text-decoration: none;
    font-weight: 900;
}

.nb-category-box h4 {
    margin: 0 0 10px;
    font-size: 15.5px;
    line-height: 1.35;
    letter-spacing: -0.05em;
    font-weight: 1000;
}

.nb-category-box li {
    display: block;
}

/* ======================================================
   Topic
   ====================================================== */

.nb-topic-cloud,
.nb-side-category {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.nb-topic-cloud a,
.nb-side-category a {
    display: inline-flex;
    align-items: center;
    padding: 7px 11px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    text-decoration: none;
    font-size: 12px;
    font-weight: 900;
}

.nb-topic-cloud a:hover,
.nb-side-category a:hover {
    background: #111827;
    color: #ffffff;
}

/* ======================================================
   Popular
   ====================================================== */

.nb-popular-grid {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
}

.nb-popular-grid li {
    display: grid;
    grid-template-columns: 25px minmax(0, 1fr) 54px;
    gap: 9px;
    align-items: center;
    min-height: 56px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--nb-line);
}

.nb-popular-grid strong,
.nb-rank-list strong {
    color: var(--nb-red);
    font-size: 18px;
    line-height: 1;
    font-weight: 1000;
}

.nb-popular-grid img {
    width: 54px;
    height: 46px;
    object-fit: cover;
    border-radius: 8px;
}

/* ======================================================
   Sidebar
   ====================================================== */

.nb-side-box,
.nb-side-guide {
    padding: 17px;
}

.nb-side-box h2 {
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #111827;
    color: var(--nb-ink);
    font-size: 16px;
    letter-spacing: -0.05em;
    font-weight: 1000;
}

.nb-rank-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.nb-rank-list li {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--nb-line);
}

.nb-rank-list li:last-child {
    border-bottom: 0;
}

.nb-rank-list a {
    font-size: 13px;
}

.nb-side-ad {
    padding: 22px 16px;
    border-radius: 16px;
    background: #111827;
    color: #ffffff;
    text-align: center;
    box-shadow: var(--nb-shadow);
}

.nb-side-ad span {
    color: #94a3b8;
    font-size: 10px;
    letter-spacing: 0.08em;
    font-weight: 1000;
}

.nb-side-ad strong {
    display: block;
    margin-top: 7px;
    font-size: 20px;
    font-weight: 1000;
}

.nb-side-ad p {
    margin: 7px 0 0;
    color: #cbd5e1;
    font-size: 12px;
    line-height: 1.45;
}

.nb-side-guide strong {
    display: block;
    margin-bottom: 7px;
    color: var(--nb-ink);
    font-size: 15px;
    font-weight: 1000;
}

.nb-side-guide p {
    margin: 0;
    color: var(--nb-muted);
    font-size: 12px;
    line-height: 1.5;
    word-break: break-all;
}

.nb-empty-box {
    grid-column: 1 / -1;
    padding: 28px;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    background: #f8fafc;
    color: #64748b;
    text-align: center;
    font-weight: 900;
}

/* ======================================================
   Responsive
   ====================================================== */

@media (max-width: 980px) {
    .nb-plus-home {
        max-width: 760px;
    }

    .nb-main-split {
        grid-template-columns: 1fr;
    }

    .nb-side-content {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .nb-card-grid,
    .nb-category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .nb-headline-overlay {
        width: 70%;
    }
}

@media (max-width: 720px) {
    .nb-plus-home {
        padding: 0 14px;
    }

    .nb-headline-card {
        min-height: 330px;
    }

    .nb-headline-overlay {
        width: 100%;
        min-height: 330px;
        padding: 24px;
        background: linear-gradient(0deg, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.16));
    }

    .nb-headline-overlay h2 {
        font-size: 26px;
    }

    .nb-issue-line {
        display: block;
    }

    .nb-issue-line span {
        display: block;
        margin-bottom: 4px;
    }

    .nb-card-grid,
    .nb-two-shot-grid,
    .nb-category-grid,
    .nb-popular-grid,
    .nb-side-content {
        grid-template-columns: 1fr;
    }

    .nb-popular-grid li {
        grid-template-columns: 25px minmax(0, 1fr);
    }

    .nb-popular-grid img {
        display: none;
    }
}

/* ======================================================
   Wide layout patch
   참고 이미지처럼 전체 가로폭 확장
   ====================================================== */

.nb-plus-home {
    width: min(1180px, calc(100vw - 48px));
    max-width: none;
    margin-left: 50%;
    margin-right: 0;
    transform: translateX(-50%);
    padding-left: 0;
    padding-right: 0;
}

/* 상단 헤드라인을 더 넓고 크게 */
.nb-headline-card {
    min-height: 340px;
    border-radius: 18px;
}

.nb-headline-overlay {
    width: 54%;
    min-height: 340px;
    padding: 40px 42px;
}

.nb-headline-overlay h2 {
    font-size: 42px;
    line-height: 1.1;
}

.nb-headline-overlay p {
    font-size: 16px;
    line-height: 1.62;
}

/* 이슈 라인도 전체 폭에 맞춤 */
.nb-issue-line {
    margin-bottom: 28px;
    padding: 13px 18px;
}

/* 헤드라인 아래부터 좌측/우측 분할 폭 확장 */
.nb-main-split {
    grid-template-columns: minmax(0, 820px) 320px;
    gap: 40px;
}

/* 좌측 카드 영역을 참고 이미지처럼 넓게 */
.nb-block,
.nb-section-wide {
    padding: 24px;
    border-radius: 18px;
}

.nb-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.nb-news-card {
    min-height: 270px;
    border-radius: 16px;
}

.nb-news-card-body {
    padding: 17px 17px 18px;
}

.nb-news-card h3 {
    font-size: 17px;
    line-height: 1.34;
}

/* 우측 사이드바도 참고 이미지처럼 살짝 넓게 */
.nb-side-box,
.nb-side-guide {
    padding: 20px;
    border-radius: 18px;
}

.nb-side-box h2 {
    font-size: 18px;
}

.nb-rank-list a,
.nb-side-news-list a {
    font-size: 14px;
    line-height: 1.42;
}

.nb-side-ad {
    border-radius: 18px;
    padding: 24px 18px;
}

/* 하단 블록도 넓어진 폭에 맞게 정리 */
.nb-category-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.nb-popular-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 22px;
}

/* 중간 화면 대응 */
@media (max-width: 1260px) {
    .nb-plus-home {
        width: min(1080px, calc(100vw - 40px));
    }

    .nb-main-split {
        grid-template-columns: minmax(0, 740px) 300px;
        gap: 32px;
    }

    .nb-headline-overlay h2 {
        font-size: 38px;
    }
}

@media (max-width: 980px) {
    .nb-plus-home {
        width: min(760px, calc(100vw - 28px));
        margin-left: auto;
        margin-right: auto;
        transform: none;
        padding-left: 0;
        padding-right: 0;
    }

    .nb-main-split {
        grid-template-columns: 1fr;
    }

    .nb-side-content {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .nb-headline-overlay {
        width: 70%;
    }

    .nb-card-grid,
    .nb-category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .nb-plus-home {
        width: calc(100vw - 28px);
    }

    .nb-headline-card {
        min-height: 330px;
    }

    .nb-headline-overlay {
        width: 100%;
        min-height: 330px;
        padding: 24px;
    }

    .nb-headline-overlay h2 {
        font-size: 26px;
    }

    .nb-card-grid,
    .nb-two-shot-grid,
    .nb-category-grid,
    .nb-popular-grid,
    .nb-side-content {
        grid-template-columns: 1fr;
    }
}

/* ======================================================
   Public home builder sync patch
   운영센터 배치 반영용 보조 스타일
   ====================================================== */

.nb-home-section {
    margin-bottom: 28px;
}

.nb-side-content .nb-home-section {
    margin-bottom: 0;
}

.nb-side-content .nb-block,
.nb-side-content .nb-section-wide {
    padding: 20px;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: var(--nb-shadow);
}

.nb-side-content .nb-card-grid,
.nb-side-content .nb-category-grid,
.nb-side-content .nb-two-shot-grid,
.nb-side-content .nb-popular-grid {
    grid-template-columns: 1fr;
}

.nb-side-content .nb-news-card {
    min-height: 210px;
}

.nb-side-content .nb-popular-grid li {
    grid-template-columns: 25px minmax(0, 1fr);
}

.nb-side-content .nb-popular-grid img {
    display: none;
}

.nb-side-content .nb-block-head-line {
    border-bottom: 2px solid #111827;
}

.nb-side-content .nb-block-head {
    margin-bottom: 12px;
}

.nb-side-content .nb-block-head h2,
.nb-side-content .nb-section-wide h2,
.nb-side-content .nb-block h2 {
    font-size: 18px;
}

.nb-main-content > .nb-side-ad {
    border-radius: 18px;
    margin-bottom: 28px;
}

.nb-main-content > .nb-side-guide {
    padding: 24px;
    border-radius: 18px;
    margin-bottom: 28px;
}


/* ======================================================
   PLUS HOME AD SLOT
   메인페이지 광고 슬롯 정렬
   ====================================================== */

.nb-plus-home > .news-ad-slot-home_top {
    margin-top: 0;
    margin-bottom: 24px;
}

.nb-main-content > .news-ad-slot-home_middle,
.nb-main-content > .news-ad-slot-home_bottom {
    margin: 24px 0;
}

.nb-side-content > .news-ad-slot-sidebar {
    margin-top: 0;
}

/* API article card safety patch */
.nb-plus-home article,
.nb-plus-home .nb-card,
.nb-plus-home .nb-news-card,
.nb-plus-home .nb-article-card,
.nb-plus-home .nb-card-item {
    overflow: hidden;
}

.nb-plus-home article h2,
.nb-plus-home article h3,
.nb-plus-home .nb-card-title,
.nb-plus-home .nb-news-title,
.nb-plus-home .nb-article-title {
    line-height: 1.34;
    word-break: keep-all;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: 2.8em;
}

.nb-plus-home article p,
.nb-plus-home .nb-card-summary,
.nb-plus-home .nb-news-summary,
.nb-plus-home .nb-article-summary {
    line-height: 1.35;
    word-break: keep-all;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: 2.8em;
}

.nb-plus-home article img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* API article cleanup final patch */
.nb-plus-home .nb-news-card h3,
.nb-plus-home .nb-news-card h3 a,
.nb-plus-home .nb-news-card-image span,
.nb-plus-home .nb-rank-list a,
.nb-plus-home .nb-side-news-list a {
    word-break: keep-all;
    overflow-wrap: anywhere;
}

.nb-plus-home .nb-news-card h3 a,
.nb-plus-home .nb-news-card-image span {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.main-figure figcaption {
    display: grid;
    gap: 4px;
    text-align: center;
}

.main-figure figcaption .image-caption-text {
    color: #475569;
}

.main-figure figcaption .image-source {
    color: #64748b;
    font-size: 12px;
}

