/*
Theme Name: The Chronicle Custom
Description: Professional News Portal Theme
Version: 1.1
Author: Custom Theme Developer
*/

/* ==========================================================================
   1. CSS Variables & Base Styles
   ========================================================================== */
:root {
    --primary-blue: #1b4b82;
    --nav-bg: #222222;
    --text-main: #2d3748;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --alert-red: #c53030;
    --bg-body: #ffffff;
    --bg-light: #f7fafc;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
}

img {
    max-width: 100%;
    height: auto;
}

/* ==========================================================================
   2. Global Layout & Containers
   ========================================================================== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Membagi 2 Kolom: Konten Utama (Kiri) dan Area Kanan (Hardcode) */
.main-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px; 
    gap: 30px;
    margin-top: 20px;
    margin-bottom: 60px;
    align-items: start;
}

.main-content {
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   3. Header & Navigation
   ========================================================================== */
.site-header {
    background: var(--primary-blue);
    color: #fff;
    padding: 25px 0;
    text-align: center;
}

.site-header h1 {
    margin: 0;
    font-size: 3.5rem;
    font-family: 'Times New Roman', Times, serif;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.site-header a {
    color: #fff;
    text-decoration: none;
}

.main-navigation {
    background: var(--nav-bg);
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.main-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
}

.main-navigation li a {
    display: block;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    padding: 15px 20px;
    text-transform: uppercase;
    transition: background 0.2s ease;
}

.main-navigation li a:hover {
    background: #444;
}

/* ==========================================================================
   4. Hero Section (Grid Atas Lanskap)
   ========================================================================== */
.top-grid-area {
    margin-bottom: 30px;
}

.hero-section {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr; /* Memaksa 3 kolom agar bentuk lanskap tercapai */
    grid-auto-rows: 160px; /* Tinggi baris diatur agar gambar melebar, tidak kotak */
    gap: 15px;
}

/* Pastikan widget membentang penuh di areanya */
.top-grid-widget-wrapper .hero-section {
    width: 100%;
}

.hero-main {
    grid-column: 1 / 2;
    grid-row: 1 / 3; /* Utama menempati 2 baris penuh */
}

/* Pengaturan penempatan 4 sub-item di area 2x2 sisa */
.hero-sub:nth-child(2) { grid-column: 2 / 3; grid-row: 1 / 2; }
.hero-sub:nth-child(3) { grid-column: 3 / 4; grid-row: 1 / 2; }
.hero-sub:nth-child(4) { grid-column: 2 / 3; grid-row: 2 / 3; }
.hero-sub:nth-child(5) { grid-column: 3 / 4; grid-row: 2 / 3; }

.hero-item {
    position: relative;
    overflow: hidden;
    border-radius: 2px;
}

.hero-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.hero-item:hover img {
    transform: scale(1.03);
}

.hero-item .title-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    color: #fff;
    padding: 30px 15px 15px;
    box-sizing: border-box;
}

.hero-main .title-overlay h2 {
    margin: 0;
    font-size: 1.6rem;
    line-height: 1.2;
}

.hero-sub .title-overlay h3 {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.3;
}

.cat-label {
    background: var(--alert-red);
    color: #fff;
    font-size: 11px;
    padding: 3px 8px;
    text-transform: uppercase;
    font-weight: bold;
    display: inline-block;
    margin-bottom: 8px;
    border-radius: 2px;
}

/* ==========================================================================
   5. Bottom News Grid (3 Kolom Bawah)
   ========================================================================== */
.bottom-news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    border-top: 1px solid var(--border-color);
    padding-top: 25px;
}

/* ==========================================================================
   Desain Judul Kategori (Ribbon & Garis Horizontal)
   ========================================================================== */
h3.section-title {
    display: flex;
    align-items: center;
    width: 100%;
    margin-top: 0;
    margin-bottom: 20px;
    background: transparent; /* Menghilangkan warna background utama */
    padding: 0;
}

/* Teks dan Kotak Pita (Ribbon) */
h3.section-title span {
    position: relative;
    z-index: 2; /* Berada di atas garis */
    background: var(--primary-blue);
    color: #fff;
    font-size: 14px;
    text-transform: uppercase;
    font-weight: bold;
    padding: 6px 20px 6px 12px;
    /* Efek potongan miring di sisi kanan */
    clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 100%, 0 100%); 
}

/* Varian Warna Merah */
h3.section-title.red span {
    background: var(--alert-red);
}

/* Garis Lurus Horizontal di Samping Pita */
h3.section-title::after {
    content: "";
    flex-grow: 1; /* Otomatis mengisi seluruh sisa ruang di sisi kanan */
    height: 2px; /* Ketebalan garis */
    background-color: var(--border-color); /* Warna garis (menggunakan variabel abu-abu) */
    margin-left: -6px; /* Menarik sedikit ujung garis agar bersembunyi di bawah potongan miring */
    z-index: 1;
}

.section-title.red {
    background: var(--alert-red);
}

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

.news-list li {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 15px;
    position: relative;
    padding-left: 15px;
}

/* Bullet merah kecil seperti pada referensi */
.news-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    width: 6px;
    height: 6px;
    background-color: var(--alert-red);
    border-radius: 50%;
}

.news-list li:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.news-list a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.4;
    display: block;
    transition: color 0.2s ease;
}

.news-list a:hover {
    color: var(--primary-blue);
}

.news-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    display: flex;
    align-items: center;
}

/* ==========================================================================
   6. Area Kanan (Pencarian & Popular Posts)
   ========================================================================== */
.right-column-area {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Form Pencarian Hardcode */
.search-box .search-form {
    display: flex;
    width: 100%;
}

.search-box .search-field {
    flex-grow: 1;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-right: none;
    outline: none;
    font-family: inherit;
    font-size: 14px;
}

.search-box .search-submit {
    background: var(--primary-blue);
    color: #fff;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s ease;
}

.search-box .search-submit:hover {
    background: #14365d;
}

/* List Berita Terpopuler */
.popular-posts-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.popular-item {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--bg-light);
}

.popular-item:last-child {
    border-bottom: none;
}

.popular-thumb {
    width: 90px;
    height: 65px;
    flex-shrink: 0;
}

.popular-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 2px;
}

.popular-content {
    display: flex;
    flex-direction: column;
}

.popular-content .pop-cat {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.popular-content h4 {
    margin: 0 0 5px 0;
    font-size: 0.95rem;
    line-height: 1.3;
}

.popular-content h4 a {
    color: var(--text-main);
    text-decoration: none;
    transition: color 0.2s ease;
}

.popular-content h4 a:hover {
    color: var(--primary-blue);
}

.popular-content .pop-meta {
    font-size: 11px;
    color: var(--text-muted);
}

/* ==========================================================================
   7. Footer
   ========================================================================== */
.site-footer {
    background: var(--nav-bg);
    color: #fff;
    padding: 30px 0;
    text-align: center;
    font-size: 14px;
}

/* ==========================================================================
   8. Responsive Design (Media Queries)
   ========================================================================== */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr; /* Area kanan turun ke bawah */
    }
    
    .right-column-area {
        margin-top: 20px;
        padding-top: 30px;
        border-top: 2px solid var(--border-color);
    }
}

@media (max-width: 768px) {
    .hero-section {
        grid-template-columns: 1fr; /* Hero menjadi 1 kolom tumpuk */
        grid-auto-rows: minmax(200px, auto);
    }
    
    .hero-main {
        grid-column: 1 / 2;
        grid-row: auto;
    }
    
    /* Mengembalikan posisi default untuk tampilan mobile tumpuk */
    .hero-sub:nth-child(n) {
        grid-column: 1 / 2;
        grid-row: auto;
    }

    .bottom-news-grid {
        grid-template-columns: 1fr; /* 3 Kolom berita bawah menjadi 1 tumpuk */
    }
    
    .main-navigation ul {
        flex-direction: column;
        text-align: center;
    }
    
    .site-header h1 {
        font-size: 2.5rem;
    }
}

/* ==========================================================================
   9. Latest News Section (Bawah Homepage)
   ========================================================================== */
.latest-news-section {
    margin-top: 40px;
    padding-top: 20px;
}

.latest-news-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.latest-news-item {
    display: flex;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.latest-news-item:last-child {
    border-bottom: none;
}

.latest-news-thumb {
    width: 220px;
    flex-shrink: 0;
}

.latest-news-thumb img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 3px;
    transition: transform 0.3s ease;
}

.latest-news-thumb:hover img {
    transform: scale(1.03);
}

.latest-news-thumb .no-thumb {
    width: 100%;
    height: 140px;
    background: #eeeeee;
    border-radius: 3px;
}

.latest-news-content {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.latest-news-content h4 {
    margin: 0 0 8px 0;
    font-size: 1.3rem;
    line-height: 1.4;
}

.latest-news-content h4 a {
    color: var(--text-main);
    text-decoration: none;
    transition: color 0.2s ease;
}

.latest-news-content h4 a:hover {
    color: var(--primary-blue);
}

.latest-news-content .post-excerpt {
    margin: 10px 0 0 0;
    font-size: 0.95rem;
    color: var(--text-main);
}

.view-all-news {
    margin-top: 25px;
    text-align: left;
}

.btn-view-all {
    display: inline-block;
    background: var(--nav-bg);
    color: #fff;
    padding: 10px 20px;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    transition: background 0.3s ease;
}

.btn-view-all:hover {
    background: var(--primary-blue);
    color: #fff;
}

/* Responsif untuk tablet dan HP */
@media (max-width: 600px) {
    .latest-news-item {
        flex-direction: column;
        gap: 10px;
    }

    .latest-news-thumb {
        width: 100%;
    }

    .latest-news-thumb img, 
    .latest-news-thumb .no-thumb {
        height: auto;
        aspect-ratio: 16/9;
    }
}

/* ==========================================================================
   10. Latest Featured Grid (2 Kolom Berita Terbaru)
   ========================================================================== */
.latest-featured-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 2px solid var(--border-color); /* Garis pemisah sebelum list 3,4,5 */
}

.latest-featured-item {
    display: flex;
    flex-direction: column;
}

.latest-featured-thumb {
    width: 100%;
    margin-bottom: 12px;
    border-radius: 3px;
    overflow: hidden;
}

.latest-featured-thumb img,
.latest-featured-thumb .no-thumb {
    width: 100%;
    height: 220px; /* Gambar dibuat besar dan presisi */
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.latest-featured-thumb:hover img {
    transform: scale(1.05); /* Efek zoom saat disentuh cursor */
}

.latest-featured-content h4 {
    margin: 0 0 8px 0;
    font-size: 1.4rem;
    line-height: 1.35;
}

.latest-featured-content h4 a {
    color: var(--text-main);
    text-decoration: none;
    transition: color 0.2s ease;
}

.latest-featured-content h4 a:hover {
    color: var(--primary-blue);
}

.latest-featured-content .post-excerpt {
    margin: 10px 0 0 0;
    font-size: 0.95rem;
    color: var(--text-main);
}

/* Responsif ke Mobile (HP) -> Otomatis jadi 1 tumpuk ke bawah */
@media (max-width: 768px) {
    .latest-featured-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   11. Sidebar Promo & Foto Kegiatan
   ========================================================================== */

/* Layout Kotak Promo (Bypass AdBlock) */
.sidebar-promo-wrapper {
    margin-bottom: 30px;
}

.promo-placeholder {
    width: 100%;
    height: 250px;
    background: #e2e8f0; 
    color: #718096;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    letter-spacing: 1px;
    border: 2px dashed #cbd5e0;
    transition: background 0.3s;
}

.promo-placeholder:hover {
    background: #cbd5e0;
}


/* Layout Galeri Foto Kegiatan */
.sidebar-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 Kolom rata */
    gap: 10px;
}

.gallery-item {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 3px;
    aspect-ratio: 1 / 1; /* Memaksa bentuk kotak sempurna (persegi) */
    background: var(--bg-light);
}

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

.gallery-item:hover img {
    transform: scale(1.1); /* Zoom saat disentuh */
}

/* Efek Tulisan "Baca" Saat Dihover */
.gallery-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 10px;
    text-align: center;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Hamburger Menu & Mobile Header Adjustments
   ========================================================================== */

/* Sembunyikan tombol hamburger di Desktop (Layar besar) */
.menu-toggle {
    display: none;
}

@media (max-width: 768px) {
    /* 1. Modifikasi Header agar Flexbox (Sejajar Kiri - Kanan) */
    .site-header {
        padding: 15px 0;
        text-align: left; /* Membatalkan text-align: center bawaan desktop */
    }

    .site-header .header-inner {
        display: flex;
        justify-content: space-between; /* Judul di kiri, Hamburger di kanan */
        align-items: center; /* Sejajar vertikal di tengah */
    }

    /* Sesuaikan ukuran font judul agar tidak bertabrakan dengan tombol */
    .site-header h1 {
        font-size: 1.8rem !important; 
        margin: 0;
    }

    /* 2. Desain Tombol Hamburger */
    .menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        width: 32px;
        height: 24px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 99; /* Pastikan bisa diklik */
    }

    .hamburger-line {
        width: 100%;
        height: 3px;
        background-color: #ffffff;
        border-radius: 2px;
        transition: all 0.3s ease-in-out; /* Animasi transisi halus */
        transform-origin: 1px;
    }

    /* Animasi Hamburger berubah menjadi (X) saat diklik */
    .menu-toggle.is-active .hamburger-line:nth-child(1) { transform: rotate(45deg); }
    .menu-toggle.is-active .hamburger-line:nth-child(2) { opacity: 0; }
    .menu-toggle.is-active .hamburger-line:nth-child(3) { transform: rotate(-45deg); }

    /* 3. Sembunyikan navigasi secara default di Mobile */
    .main-navigation {
        display: none;
        width: 100%;
    }

    /* Tampilkan navigasi saat tombol diklik (Class dari JS) */
    .main-navigation.toggled {
        display: block;
    }

    /* Merapikan List Menu saat Terbuka */
    .main-navigation ul {
        flex-direction: column;
        text-align: left !important;
    }

    .main-navigation li a {
        padding: 12px 15px;
        border-bottom: 1px solid #333333; /* Memberi garis batas antar menu */
    }
}

/* Styling Tambahan untuk Halaman Single */
.entry-content a { color: var(--primary-blue); font-weight: bold; text-decoration: underline; }
.entry-content a:hover { color: var(--alert-red); }
.post-tags a:hover { background: var(--primary-blue) !important; color: #fff !important; }
.post-navigation a { color: var(--primary-blue); text-decoration: none; }
.post-navigation a:hover { text-decoration: underline; }

/* ==========================================================================
   Single Post - Social Share Buttons
   ========================================================================== */
.social-share-wrapper {
    margin: 0 0 30px 0;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap; /* Mencegah tombol keluar layar di HP */
}

.share-title {
    font-size: 13px;
    font-weight: bold;
    color: var(--text-muted);
    text-transform: uppercase;
}

.share-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: bold;
    color: #fff !important; /* Memaksa warna font jadi putih */
    text-decoration: none !important;
    border-radius: 3px;
    transition: opacity 0.3s ease, transform 0.2s ease;
}

/* Efek Hover (Melayang Sedikit) */
.share-btn:hover {
    opacity: 0.85;
    transform: translateY(-2px); 
}

/* Warna Brand Platform Resmi */
.btn-fb { background-color: #1877F2; } /* Facebook Blue */
.btn-x  { background-color: #000000; } /* X / Twitter Black */
.btn-wa { background-color: #25D366; } /* WhatsApp Green */
.btn-tg { background-color: #229ED9; } /* Telegram Blue */

/* Responsif Mobile (HP) */
@media (max-width: 600px) {
    .social-share-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .share-buttons {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, 1fr); /* Menjadi kotak 2 baris x 2 kolom di HP */
    }

    .share-btn {
        width: 100%;
        box-sizing: border-box;
    }
}
/* ==========================================================================
   12. Custom Logo Styles
   ========================================================================== */
.site-branding .custom-logo-link {
    display: inline-block;
    transition: opacity 0.3s ease;
}

.site-branding .custom-logo-link:hover {
    opacity: 0.8;
}

.site-branding .custom-logo {
    max-width: 100%;
    height: auto;
    max-height: 70px; /* Membatasi tinggi logo agar header tidak terlalu tebal */
    width: auto;
    display: block;
    object-fit: contain;
}

/* Penyesuaian batas tinggi logo untuk layar HP agar lebih rapi */
@media (max-width: 768px) {
    .site-branding .custom-logo {
        max-height: 45px; 
    }
}

/* ==========================================================================
   Perbaikan Tabrakan Header Mobile (Logo vs Hamburger)
   ========================================================================== */
@media (max-width: 768px) {
    /* 1. Atur container utama agar punya batasan jarak (gap) */
    .site-header .header-inner {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: nowrap !important; /* Memaksa agar mereka tidak bertumpuk berantakan */
        gap: 20px; /* Jarak aman antara logo dan hamburger */
    }

    /* 2. Batasi area tempat logo berada */
    .site-branding {
        flex: 1; /* Biarkan container logo mengisi ruang kosong yang tersedia... */
        max-width: calc(100% - 55px); /* ...TAPI sisakan 55px untuk tombol hamburger + jarak */
        display: flex;
        align-items: center;
    }

    /* 3. Paksa gambar logo patuh pada batas areanya */
    .site-branding .custom-logo {
        width: auto !important;
        max-width: 100% !important; /* Tidak boleh lebih lebar dari batas di atas */
    }

    /* 4. Lindungi tombol hamburger agar tidak menyusut/gepeng saat terdesak */
    .menu-toggle {
        flex-shrink: 0; /* Aturan absolut: Tombol ini TIDAK BOLEH mengecil */
    }
}
