/* ============================================================
   NATIVE.Com — berita.css | Article Page Styles
   ============================================================ */

/* ---- Self-hosted Poppins (lokal, tanpa Google Fonts CDN) ---- */
@font-face {
    font-family: 'Poppins';
    src: url('aset/poppins/Poppins-Regular.ttf') format('truetype');
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Poppins';
    src: url('aset/poppins/Poppins-Medium.ttf') format('truetype');
    font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Poppins';
    src: url('aset/poppins/Poppins-SemiBold.ttf') format('truetype');
    font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Poppins';
    src: url('aset/poppins/Poppins-Bold.ttf') format('truetype');
    font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Poppins';
    src: url('aset/poppins/Poppins-ExtraBold.ttf') format('truetype');
    font-weight: 800; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Poppins';
    src: url('aset/poppins/Poppins-Black.ttf') format('truetype');
    font-weight: 900; font-style: normal; font-display: swap;
}

/* ---- Page wrapper ---- */
.article-page {
    background: #f7f8fc;
    padding: 40px 0 60px;
    min-height: 60vh;
    /* Prevent any child from bleeding out horizontally */
    overflow-x: hidden;
    box-sizing: border-box;
}

/* ---- Two-column layout: article + sidebar ---- */
.article-layout {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 40px;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
    align-items: start;
    box-sizing: border-box;
}

/* ============================================================
   ARTICLE MAIN
   ============================================================ */
.article-main {
    background: #fff;
    border-radius: 12px;
    padding: 40px 44px 48px;
    box-shadow: 0 2px 16px rgba(10,23,68,0.06);
}

/* Breadcrumb */
.article-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.article-breadcrumb a {
    color: var(--text-muted);
    transition: color 0.2s;
}

.article-breadcrumb a:hover {
    color: var(--navy-dark);
    opacity: 1;
}

.article-breadcrumb .fa-chevron-right {
    font-size: 0.6rem;
    color: #ccc;
}

/* Category tag */
.article-category-tag {
    display: inline-block;
    background: var(--accent-red);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 4px;
    margin-bottom: 14px;
}

/* Article title */
.article-title {
    font-family: 'Poppins', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.3;
    margin-bottom: 20px;
}

/* Meta row */
.article-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eef0f5;
}

.article-author-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.article-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e5e7ef;
}

.article-author-name {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
}

.article-date {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
    gap: 4px;
}

/* Share buttons */
.article-share-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.share-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 0.85rem;
    color: #fff;
    transition: transform 0.15s ease, opacity 0.15s;
}

.share-btn:hover { transform: scale(1.1); opacity: 1; }
.share-fb { background: #1877f2; }
.share-tw { background: #000; }
.share-wa { background: #25d366; }
.share-cp { background: #6b7280; }

/* Hero image */
.article-hero-figure {
    margin: 0 0 28px;
    border-radius: 10px;
    overflow: hidden;
}

.article-hero-img {
    width: 100%;
    /* Pakai aspect-ratio agar gambar tidak terpotong di layar sempit */
    aspect-ratio: 16 / 9;
    height: auto;
    max-height: 420px;
    object-fit: cover;
    display: block;
    border-radius: 10px;
}

.article-hero-figure figcaption,
.article-inline-figure figcaption {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 8px;
    padding: 0 4px;
    line-height: 1.5;
}

/* ============================================================
   TABLE OF CONTENTS
   ============================================================ */
.toc-wrapper {
    background: #f4f6fb;
    border: 1px solid #dde2f0;
    border-left: 4px solid var(--navy-dark);
    border-radius: 8px;
    margin-bottom: 32px;
    overflow: hidden;
}

.toc-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-primary);
    color: var(--navy-dark);
    gap: 8px;
}

.toc-toggle-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.92rem;
}

.toc-toggle strong {
    font-size: 0.92rem;
    font-weight: 700;
}

.toc-chevron {
    font-size: 0.8rem;
    color: var(--navy-dark);
    transition: transform 0.3s ease;
}

/* Hidden by default */
.toc-list {
    display: none;
    padding: 0 18px 16px 18px;
    counter-reset: toc-counter;
}

.toc-list.toc-open {
    display: block;
}

.toc-list li {
    margin-bottom: 6px;
}

.toc-main {
    margin-left: 0;
    font-size: 0.88rem;
}

.toc-sub {
    margin-left: 20px;
    font-size: 0.82rem;
}

.toc-main > a { font-weight: 600; }

.toc-list a {
    color: var(--navy-dark);
    text-decoration: none;
    line-height: 1.5;
    transition: color 0.2s;
}

.toc-list a:hover {
    color: var(--accent-red);
    opacity: 1;
}

/* ============================================================
   ARTICLE BODY TYPOGRAPHY
   ============================================================ */
.article-body {
    font-size: 1rem;
    color: #2d2d3d;
    line-height: 1.85;
    overflow-wrap: break-word;
    word-break: break-word;
    /* Kunci utama: paksa semua elemen di dalam artikel tidak overflow */
    overflow: hidden;
    max-width: 100%;
}

/* Override paksa semua elemen anak dari copy-paste eksternal */
.article-body * {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Paksa tabel dari copy-paste agar tidak meluber */
.article-body table {
    display: block;
    overflow-x: auto;
    width: 100% !important;
    white-space: normal;
}

/* Paksa semua link agar tidak keluar dari container */
.article-body a {
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal !important;
    display: inline;
    max-width: 100% !important;
}

/* Paksa semua div/section/span agar tidak fixed width */
.article-body div,
.article-body section,
.article-body span {
    max-width: 100% !important;
    white-space: normal !important;
}

.article-body img,
.article-body iframe,
.article-body video {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
    /* Allow inline style to override display and margin for centering */
}

/* Centered images (margin: auto via inline style) */
.article-body img[style*="margin: 10px auto"],
.article-body img[style*="margin:10px auto"],
.article-body img[style*="margin: auto"],
.article-body img[style*="margin:auto"] {
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Right-aligned images */
.article-body img[style*="margin: 10px 0 10px auto"],
.article-body img[style*="margin:10px 0 10px auto"] {
    display: block !important;
    margin-left: auto !important;
    margin-right: 0 !important;
}

.article-body h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--navy-dark);
    margin: 36px 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #eef0f8;
    scroll-margin-top: 80px;
}

.article-body h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 26px 0 10px;
    scroll-margin-top: 80px;
}

.article-body p {
    margin-bottom: 18px;
}

/* If a paragraph has text-align:center (from editor justifyCenter), its images should also be centered */
.article-body p[style*="text-align: center"] img,
.article-body p[style*="text-align:center"] img {
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.article-body p[style*="text-align: right"] img,
.article-body p[style*="text-align:right"] img {
    display: block !important;
    margin-left: auto !important;
    margin-right: 0 !important;
}

.article-inline-figure {
    margin: 24px 0;
    border-radius: 8px;
    overflow: hidden;
}

.article-inline-figure img {
    width: 100%;
    height: 340px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

/* Blockquote */
.article-blockquote {
    border-left: 4px solid var(--accent-red);
    background: #fff8f8;
    margin: 28px 0;
    padding: 18px 24px;
    border-radius: 0 8px 8px 0;
}

.article-blockquote p {
    font-style: italic;
    font-size: 1.05rem;
    color: var(--navy-dark);
    margin-bottom: 8px;
    line-height: 1.7;
}

.article-blockquote cite {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: normal;
    font-weight: 600;
}

/* Article list */
.article-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
}

.article-list li {
    padding: 7px 0 7px 24px;
    position: relative;
    font-size: 0.97rem;
    color: #2d2d3d;
    border-bottom: 1px solid #f0f0f5;
}

.article-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-red);
}

/* ---- Tags ---- */
.article-tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;  /* WAJIB: agar tag tidak lari ke kanan */
    gap: 8px;
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px solid #eef0f5;
    overflow: hidden;
    max-width: 100%;
}

.tags-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
}

.article-tag {
    display: inline-block;
    padding: 5px 14px;
    background: #eef0f8;
    color: var(--navy-dark);
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 20px;
    transition: background 0.2s, color 0.2s;
}

.article-tag:hover {
    background: var(--navy-dark);
    color: #fff;
    opacity: 1;
}

/* ---- Author card ---- */
.author-card {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    background: #f4f6fb;
    border-radius: 10px;
    padding: 22px 24px;
    margin-top: 32px;
}

.author-card-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 3px solid #dde2f0;
}

.author-card-label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.author-card-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--navy-dark);
    margin: 0 0 6px;
}

.author-card-bio {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.article-sidebar {
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar-widget {
    background: #fff;
    border-radius: 10px;
    padding: 20px 20px 16px;
    box-shadow: 0 2px 12px rgba(10,23,68,0.06);
}

.sidebar-widget-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--navy-dark);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent-red);
}

/* Share */
.sidebar-share {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-share-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 7px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-primary);
    color: #fff;
    transition: opacity 0.2s, transform 0.15s;
}

.sidebar-share-btn:hover { opacity: 0.88; transform: translateX(3px); }
.sb-fb { background: #1877f2; }
.sb-tw { background: #000; }
.sb-wa { background: #25d366; }
.sb-cp { background: #6b7280; }

/* Related */
.sidebar-related {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sidebar-related-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    color: inherit;
    transition: opacity 0.2s;
}

.sidebar-related-item:hover { opacity: 0.8; }

.sidebar-related-item img {
    width: 72px;
    height: 52px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.sidebar-related-item div p {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.45;
    margin-bottom: 4px;
}

.sidebar-related-item div span {
    font-size: 0.74rem;
    color: var(--text-muted);
}

/* ============================================================
   RESPONSIVE — Tablet
   ============================================================ */
@media (max-width: 992px) {
    .article-layout {
        grid-template-columns: 1fr;
        padding: 0 24px;
    }
    .article-sidebar {
        position: static;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
    .article-title { font-size: 1.7rem; }
}

/* ============================================================
   RESPONSIVE — Mobile (9:16 portrait)
   ============================================================ */
@media (max-width: 640px) {
    .article-page { padding: 16px 0 36px; overflow-x: hidden; }
    /* Pastikan layout tidak melebihi lebar layar */
    .article-layout {
        padding: 0 12px;
        gap: 16px;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }
    .article-main {
        padding: 18px 16px 28px;
        border-radius: 8px;
        box-shadow: none;
        border: 1px solid #eef0f5;
        /* Pastikan konten tidak overflow ke kanan */
        overflow: hidden;
        box-sizing: border-box;
        width: 100%;
    }
    .article-title { font-size: 1.25rem; line-height: 1.35; }
    .article-meta { flex-direction: column; align-items: flex-start; gap: 6px; }
    /* Gambar hero: pakai aspect-ratio agar proporsional, bukan fixed height */
    .article-hero-img {
        height: auto;
        aspect-ratio: 16 / 9;
        max-height: 240px;
        border-radius: 8px;
    }
    .article-hero-figure { margin-bottom: 16px; }
    .article-inline-figure img {
        height: auto;
        aspect-ratio: 16 / 9;
        max-height: 220px;
    }
    .article-body { font-size: 0.92rem; line-height: 1.75; overflow-wrap: break-word; word-break: break-word; }
    .article-body h2 { font-size: 1.15rem; margin: 20px 0 10px; }
    .article-body h3 { font-size: 1rem; margin: 16px 0 8px; }
    .article-body p { margin-bottom: 14px; }
    .article-body blockquote { padding: 12px 14px; font-size: 0.9rem; }
    /* Gambar di dalam isi artikel juga harus responsive */
    .article-body img { max-width: 100%; height: auto; }
    .article-sidebar { grid-template-columns: 1fr; }
    .author-card { flex-direction: column; gap: 12px; }
    .sidebar-widget {
        padding: 14px 14px 12px;
        box-shadow: none;
        border: 1px solid #eef0f5;
    }
    .toc-wrapper { margin: 14px 0; }
    .article-tags { gap: 6px; }
    .article-breadcrumb { font-size: 0.74rem; gap: 4px; }
}

@media (max-width: 400px) {
    .article-layout { padding: 0 8px; }
    .article-main { padding: 14px 12px 22px; }
    .article-title { font-size: 1.1rem; }
    /* Di layar sangat sempit (9:16), biarkan aspect-ratio yang mengatur tinggi */
    .article-hero-img {
        height: auto;
        max-height: 200px;
        aspect-ratio: 16 / 9;
    }
    .article-body { font-size: 0.88rem; }
}
