/* =========================================================================
 * 1. CORE VARIABLES (Gemini UI System)
 * ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Inter:wght@400;500;600;700&family=Noto+Sans+Arabic:wght@400;700&display=swap');

:root {
    --primary-text: #3c4043;
    --heading-text: #1f1f1f;
    --secondary-text: #5f6368;
    --accent-color: #1a73e8; 
    --bg-color: #f8f9fa;
    --surface-color: #ffffff;
    --border-color: #dadce0;
    --hover-bg: rgba(26, 115, 232, 0.04);
    
    --font-heading: 'Inter', sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    --font-arabic: 'Noto Sans Arabic', sans-serif;
    --font-amiri: 'Amiri', serif;

    --radius-lg: 28px;
    --radius-md: 16px;
    --shadow-soft: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.1);
}

/* =========================================================================
 * 2. GLOBAL RESET & LAYOUT
 * ========================================================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-body);
    color: var(--primary-text);
    background-color: var(--bg-color);
    line-height: 1.625;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
}

#main { padding: 40px 0; }

.main-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 48px;
    align-items: start;
}

@media (max-width: 900px) {
    .main-layout { grid-template-columns: 1fr; }
}

/* =========================================================================
 * 3. HEADER & MAIN NAVIGATION (Updated with Logo & Branding)
 * ========================================================================= */
header {
    background: var(--surface-color);
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Mengizinkan pembungkusan ke baris baru */
    gap: 12px;
}

/* --- BRANDING SECTION (Logo + Text) --- */
.branding a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

#site-logo {
    height: 42px; /* Menyesuaikan tinggi header agar tetap slim */
    width: auto;
    flex-shrink: 0;
}

.branding-text {
    display: flex;
    flex-direction: column;
}

#site-name {
    margin: 0;
    line-height: 1.1;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--heading-text);
}

#site-tagline {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.8;
    color: var(--primary-text);
}

/* --- CONTROLS SECTION (Nav + Lang) --- */
.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

#main-nav {
    display: flex;
    align-items: center;
}

.nav-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--heading-text);
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-right: 1px solid var(--border-color);
    padding-right: 20px;
}

.nav-btn:hover {
    color: var(--accent-color);
}

.lang-dropdown {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    font-family: var(--font-body);
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--primary-text);
    transition: border-color 0.2s;
}

.lang-dropdown:hover {
    border-color: var(--accent-color);
}

/* --- RESPONSIVE MOBILE ADJUSTMENTS --- */
@media (max-width: 600px) {
    .header-container {
        flex-direction: column; 
        align-items: flex-start;
        padding: 0.8rem 15px;
    }

    .branding {
        width: 100%;
    }

    #site-logo {
        height: 36px; /* Lebih kecil sedikit di mobile */
    }

    #site-name { 
        font-size: 1.2rem; 
    }

    .header-controls {
        width: 100%; 
        display: flex;
        justify-content: flex-end; 
        align-items: center;
        gap: 10px;
        border-top: 1px solid var(--border-color);
        padding-top: 10px;
        margin-top: 4px;
    }

    .nav-btn { 
        border-right: none; 
        padding: 6px 10px; 
        font-size: 0.8rem;
    }

    .lang-dropdown {
        padding: 4px 8px;
        font-size: 0.8rem;
    }
}

/* =========================================================================
 * 4. FEATURED GRID (P1: 2x2 Left, P2-P5: 1x1 Right)
 * ========================================================================= */
.featured-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    grid-template-rows: repeat(2, 220px);
    gap: 16px;
    margin-bottom: 56px;
}

.featured-item {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #f0f0f0;
    text-decoration: none;
    display: block;
}

.featured-item.p1 { grid-row: span 2; }

.featured-item img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.featured-item:hover img { transform: scale(1.05); }

.featured-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 60%, transparent 100%);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    color: white;
}

.featured-item.p1 h3 { font-size: 1.8rem; font-weight: 800; }
.featured-item h3 { font-size: 1rem; font-weight: 700; line-height: 1.3; margin: 0; }
.featured-overlay .meta { font-size: 0.75rem; text-transform: uppercase; margin-bottom: 8px; opacity: 0.9; }

@media (max-width: 850px) {
    .featured-grid { grid-template-columns: 1fr; grid-template-rows: auto; }
    .featured-item.p1 { grid-row: span 1; height: 280px; }
    .featured-item { height: 200px; }
}

/* =========================================================================
 * 5. VIEW HOME - POST LIST (REFINED MARGINS & ALIGNMENT)
 * ========================================================================= */
.post-list { display: flex; flex-direction: column; gap: 24px; }

.post-card {
    background: var(--surface-color);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    display: grid;
    grid-template-columns: 260px 1fr;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    /* Kunci tinggi agar seragam */
    height: 200px; 
}

/* Gambar dikunci agar tidak merusak padding teks */
.post-card img { 
    width: 260px; 
    height: 100%; 
    object-fit: cover; 
    flex-shrink: 0; /* Mencegah gambar menyusut */
}

.post-info { 
    padding: 24px; /* Padding seragam di semua sisi */
    display: flex; 
    flex-direction: column; 
    justify-content: flex-start; /* Mulai dari atas, bukan center */
    overflow: hidden;
}

/* Meta (Tanggal & Views) */
.post-info .meta { 
    font-size: 0.8rem; 
    color: var(--secondary-text); 
    margin-bottom: 6px; /* Jarak kecil ke judul */
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Judul (H3) */
.post-info h3 { 
    font-size: 1.25rem; 
    margin: 0 0 8px 0; /* Reset margin atas, beri jarak bawah */
    color: var(--heading-text); 
    line-height: 1.3;
    font-weight: 700;
    /* Line clamping 2 baris */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Teaser (P) */
.post-info p {
    font-size: 0.95rem; 
    color: var(--primary-text);
    line-height: 1.5;
    margin: 0;
    /* Line clamping 2 baris agar sisa ruang aman */
    display: -webkit-box; 
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical;
    overflow: hidden;
    opacity: 0.85;
}

@media (max-width: 768px) {
    .post-card { 
        grid-template-columns: 1fr; 
        height: auto; 
    }
    .post-card img { 
        width: 100%;
        height: 200px; 
    }
    .post-info { padding: 20px; }
}

/* =========================================================================
 * 6. VIEW READ - ARTICLE DETAIL & ANTI-OVERRUN
 * ========================================================================= */
#view-read { animation: fadeIn 0.5s ease-out; }

.btn-back {
    background: transparent; border: none; color: var(--accent-color);
    font-weight: 600; cursor: pointer; margin-bottom: 24px;
    display: flex; align-items: center; gap: 8px; transition: transform 0.2s;
}
.btn-back:hover { transform: translateX(-5px); }

#view-read article {
    background: var(--surface-color); padding: 56px;
    border-radius: var(--radius-lg); border: 1px solid var(--border-color);
    box-shadow: var(--shadow-soft);
    width: 100%; max-width: 100%; overflow-wrap: break-word;
}

.article-title {
    font-size: 2.5rem; font-weight: 700; line-height: 1.2;
    color: var(--heading-text); margin-bottom: 24px;
}

.article-header img {
    width: 100%; max-width: 100%; height: auto; max-height: 500px;
    object-fit: cover; border-radius: var(--radius-md); margin-bottom: 40px;
}

.article-body { font-size: 1.125rem; line-height: 1.8; }
.article-body p { margin-bottom: 1.8rem; }
.article-body h3 { font-size: 1.75rem; color: var(--heading-text); margin: 3.5rem 0 1.5rem; font-weight: 600; }

/* Menangani gambar di dalam artikel agar tidak overrun */
.article-body img, .centered-img {
    max-width: 100%; height: auto; display: block;
    margin: 2.5rem auto; border-radius: var(--radius-md); box-shadow: var(--shadow-soft);
}

.article-body ol, .article-body ul { margin: 2rem 0; padding-left: 2rem; }
.article-body li { margin-bottom: 1rem; }

@media (max-width: 768px) {
    #view-read article { padding: 24px; }
    .article-title { font-size: 1.8rem; }
    .article-header img { margin-bottom: 24px; }
}

/* =========================================================================
 * 7. SPECIAL ELEMENTS (Quran, Quotes)
 * ========================================================================= */
.quran-verse {
    font-family: var(--font-amiri); font-size: 2.4rem; background: #f1f3f4;
    padding: 40px; border-radius: var(--radius-md); margin: 3rem 0 1rem;
    text-align: right; direction: rtl; line-height: 2.2; color: #1a1b1f;
}

.quran-verse + p, .quran-verse + div:not(.quran-translation) { 
    text-align: center; font-style: italic; opacity: 0.8; margin-bottom: 3rem; 
}

.quran-translation {
    text-align: center; font-size: 1rem; color: var(--secondary-text);
    margin: -1rem 0 3rem; padding: 0 20px; line-height: 1.5; font-style: italic;
}

.quran-translation strong {
    display: block; margin-top: 8px; color: var(--primary-text); font-size: 0.85rem; font-style: normal;
}

.quote-box {
    margin: 3.5rem 0; padding: 24px 32px; border-left: 4px solid var(--accent-color);
    background: #f8f9fa; border-radius: 0 16px 16px 0; font-style: italic;
}

/* =========================================================================
 * 8. UI LABELS & SIDEBAR
 * ========================================================================= */

/* Container Utama Kategori (Paling Atas) */
#category-bar { 
    margin-bottom: 20px; 
}

/* Judul Blok (Shared Style: Category, Recent, Sidebar) */
#category-bar h3, 
#recent-bar h3, 
.sidebar-title { 
    font-size: 0.75rem; 
    text-transform: uppercase; 
    letter-spacing: 0.12em; 
    margin-bottom: 16px; 
    opacity: 0.6; 
    font-weight: 700;
    display: flex; 
    align-items: center; 
    gap: 10px;
    color: var(--secondary-text);
}

/* Garis dekoratif setelah Judul */
#category-bar h3::after, 
#recent-bar h3::after, 
.sidebar-title::after {
    content: ""; 
    flex: 1; 
    height: 1px; 
    background: var(--border-color);
}

/* Navigasi Kategori (Pill Buttons) */
#category-nav { 
    display: flex; 
    gap: 10px; 
    flex-wrap: wrap; 
    margin-bottom: 0; 
}

#category-nav a {
    text-decoration: none; 
    padding: 8px 18px; 
    background: var(--surface-color); 
    border: 1px solid var(--border-color); 
    border-radius: 50px; 
    font-size: 0.85rem; 
    color: var(--primary-text); 
    transition: all 0.2s ease;
    font-weight: 500;
}

#category-nav a.active, 
#category-nav a:hover { 
    border-color: var(--accent-color); 
    color: var(--accent-color); 
    background: var(--hover-bg); 
    transform: translateY(-1px);
}

/* Featured Grid Spacing (Visual Tengah) */
.featured-grid {
    margin-top: 24px;
    margin-bottom: 48px;
}

/* --- Recent Bar Styling (Di bawah Featured) --- */
#recent-bar {
    margin-bottom: 12px; 
    padding-bottom: 4px;
}

#recent-bar h3 {
    margin-bottom: 12px;
}

/* --- Sidebar Styling (Read Also & Popular) --- */
.sidebar-block {
    margin-bottom: 40px;
}

.popular-item { 
    display: flex; 
    gap: 12px; 
    padding: 16px 0; 
    border-bottom: 1px solid var(--border-color); 
}

.popular-item:last-child {
    border-bottom: none;
}

/* Style khusus untuk nomor peringkat agar tidak terlalu dominan */
.popular-item .rank { 
    font-size: 1.1rem; 
    font-weight: 800; 
    color: var(--accent-color); 
    opacity: 0.25; 
    min-width: 24px;
    text-align: center;
}

.popular-item h4 { 
    font-size: 0.9rem; 
    line-height: 1.4; 
    font-weight: 600; 
    margin: 0;
}

.popular-item h4 a { 
    text-decoration: none; 
    color: var(--heading-text); 
}

.popular-item h4 a:hover { 
    color: var(--accent-color); 
}

/* Layout Utama */
#main { 
    padding: 24px 0; 
}

.post-list { 
    display: flex;
    flex-direction: column;
    gap: 20px; 
}

/* Footer Section */
#site-footer { 
    padding: 40px 0; 
    border-top: 1px solid var(--border-color); 
    margin-top: 60px; 
    text-align: center; 
    font-size: 0.85rem; 
    opacity: 0.6; 
}


/* =========================================================================
 * 9. SKELETON LOADERS (Optimized & Adaptive)
 * ========================================================================= */
.skeleton-loader { width: 100%; display: flex; flex-direction: column; gap: 24px; }

.skeleton-card {
    background: var(--surface-color); 
    border-radius: var(--radius-md); 
    height: 180px;
    display: grid; 
    grid-template-columns: 260px 1fr; 
    overflow: hidden; 
    border: 1px solid var(--border-color);
}

.skeleton-img, .skeleton-line {
    background: linear-gradient(110deg, #ececec 8%, #f5f5f5 18%, #ececec 33%);
    background-size: 200% 100%; 
    animation: shine 1.5s linear infinite;
}

.skeleton-text-wrap { 
    padding: 24px 32px; 
    display: flex; 
    flex-direction: column; 
    gap: 12px; 
    justify-content: center; 
}

.skeleton-line { height: 16px; border-radius: 4px; }
.skeleton-line.title { height: 24px; width: 80%; }
.skeleton-line.meta { height: 12px; width: 40%; }
.skeleton-line.desc { height: 14px; width: 95%; }

/* --- Mode Detail Artikel (Saat slug aktif) --- */
.view-read-skeleton .skeleton-card {
    grid-template-columns: 1fr; /* Stack vertical */
    height: auto;
    border: none; /* Hilangkan border kotak agar menyatu dengan layout baca */
    background: transparent;
}

.view-read-skeleton .skeleton-img {
    height: 350px; /* Area gambar header yang luas */
    width: 100%;
    border-radius: var(--radius-md);
}

.view-read-skeleton .skeleton-text-wrap {
    padding: 32px 0; /* Sesuaikan dengan padding artikel asli */
}

/* --- Responsif Mobile --- */
@media (max-width: 768px) {
    .skeleton-card {
        grid-template-columns: 1fr;
        height: auto;
    }
    .skeleton-img { height: 200px; }
    .skeleton-text-wrap { padding: 16px; }
    
    .view-read-skeleton .skeleton-img {
        height: 250px; /* Sedikit lebih pendek di mobile */
    }
}

@keyframes shine { to { background-position-x: -200%; } }