/* =========================================================
   POPULASI DUNIA — Stylesheet Utama
   Prinsip: minimalis, elegan, tanpa icon/emoji, tanpa horizontal scroll.
   Tipografi: Times New Roman (judul/serif) + Calibri (isi/sans).
   Tema: Light (krem/putih + hijau tua) & Dark (hitam + hijau).
   Toggle tema & navbar mobile memakai teknik "checkbox hack" murni CSS.
   ========================================================= */

:root {
    --serif: "Times New Roman", Georgia, "Liberation Serif", serif;
    --sans: Calibri, "Segoe UI", "Helvetica Neue", Arial, sans-serif;

    /* Light mode (default) */
    --bg: #FBF9F4;
    --bg-alt: #F2EEE3;
    --text: #1A1A18;
    --text-muted: #55564F;
    --accent: #14532D;      /* hijau tua */
    --accent-strong: #0B3A1F;
    --border: #DCD6C4;
    --card-bg: #FFFFFF;
    --shadow: 0 1px 3px rgba(20, 83, 45, 0.08);

    --max-width: 1180px;
    --radius: 4px;
}

[data-theme="dark"] {
    --bg: #0B0C0A;
    --bg-alt: #141511;
    --text: #EDEFE9;
    --text-muted: #A9AC9E;
    --accent: #3FCF6A;      /* hijau terang di atas hitam */
    --accent-strong: #58E381;
    --border: #262820;
    --card-bg: #121310;
    --shadow: 0 1px 3px rgba(63, 207, 106, 0.08);
}

* { box-sizing: border-box; }

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
    transition: background 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4 {
    font-family: var(--serif);
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
    margin: 0 0 0.5em;
}

h1 { font-size: clamp(1.8rem, 4vw, 2.75rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.4rem, 2.6vw, 2rem); }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1em; color: var(--text-muted); }

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover, a:focus-visible { color: var(--accent-strong); text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

img { max-width: 100%; display: block; }

.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* ============ HEADER / NAVBAR (checkbox hack) ============ */

.site-header {
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 50;
}

.nav-wrap {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--text);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}
.brand:hover { text-decoration: none; color: var(--accent); }

/* Hidden checkboxes drive the toggles */
#nav-toggle, #theme-toggle { display: none; }

.nav-toggle-label {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 30px;
    height: 24px;
    cursor: pointer;
}
.nav-toggle-label span {
    display: block;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
}

.nav-desktop {
    display: flex;
    align-items: center;
    gap: 22px;
    flex: 1;
    justify-content: flex-end;
}

.nav-links {
    display: flex;
    gap: 22px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
}
.nav-links a:hover { color: var(--accent); text-decoration: none; }

.lang-select, .theme-btn {
    font-family: var(--sans);
    font-size: 0.9rem;
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 10px;
    cursor: pointer;
}

.theme-btn-label {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    background: var(--card-bg);
    color: var(--text);
    white-space: nowrap;
}

/* Mobile nav panel driven purely by #nav-toggle:checked */
.nav-mobile {
    display: none;
}

@media (max-width: 860px) {
    .nav-desktop { display: none; }
    .nav-toggle-label { display: flex; }

    .nav-mobile {
        display: block;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        border-top: 1px solid var(--border);
    }
    #nav-toggle:checked ~ .nav-mobile {
        max-height: 500px;
    }
    .nav-mobile .container {
        padding: 16px 20px 20px;
        display: flex;
        flex-direction: column;
        gap: 14px;
    }
    .nav-mobile a {
        color: var(--text);
        font-weight: 600;
        font-size: 1rem;
    }
    .nav-mobile .mobile-controls {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
        padding-top: 6px;
        border-top: 1px solid var(--border);
    }
}

/* ============ HERO ============ */

.hero {
    padding: 56px 0 40px;
    border-bottom: 1px solid var(--border);
}
.hero .eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.78rem;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 10px;
}
.hero p.lead {
    max-width: 640px;
    font-size: 1.05rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    margin-top: 32px;
}
.stat-card {
    background: var(--card-bg);
    padding: 22px 18px;
}
.stat-card .value {
    font-family: var(--serif);
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--accent);
}
.stat-card .label {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 4px;
}

@media (max-width: 720px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============ SECTIONS / CARDS ============ */

section { padding: 48px 0; }
section.alt { background: var(--bg-alt); }

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}
.card h3 { margin-bottom: 6px; }
.card .pop { color: var(--accent); font-weight: 700; font-family: var(--serif); font-size: 1.15rem; }
.card .meta { font-size: 0.85rem; color: var(--text-muted); }

.card-link { display: block; }
.card-link:hover { text-decoration: none; }
.card-link:hover .card { border-color: var(--accent); }

/* ============ TABLES ============ */

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    font-size: 0.92rem;
}
th, td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
th {
    font-family: var(--serif);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }

/* ============ DETAIL PAGE ============ */

.breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 18px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }

.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 32px;
}
@media (max-width: 860px) {
    .detail-grid { grid-template-columns: 1fr; }
}

.fact-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.fact-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
    font-size: 0.92rem;
}
.fact-list li:last-child { border-bottom: none; }
.fact-list .k { color: var(--text-muted); }
.fact-list .v { font-weight: 600; text-align: right; }

.chart-box {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin: 20px 0;
}

/* ============ MAP ============ */

#map-canvas {
    width: 100%;
    height: 520px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.map-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-top: 16px;
}

/* ============ FORMS / BUTTONS ============ */

.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 11px 22px;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
}
.btn:hover { background: var(--accent-strong); color: #fff; text-decoration: none; }
.btn-outline {
    display: inline-block;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 10px 22px;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.95rem;
}
.btn-outline:hover { background: var(--accent); color: #fff; text-decoration: none; }

/* ============ FOOTER ============ */

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--bg-alt);
    padding: 36px 0 24px;
    margin-top: 40px;
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 24px;
}
@media (max-width: 720px) {
    .footer-grid { grid-template-columns: 1fr; }
}
.footer-grid h4 { font-size: 0.95rem; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin-bottom: 8px; }
.footer-links a { color: var(--text-muted); font-size: 0.9rem; }
.footer-links a:hover { color: var(--accent); }
.footer-bottom {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

/* ============ RTL support ============ */
[dir="rtl"] .fact-list li { flex-direction: row-reverse; }
[dir="rtl"] .footer-bottom { flex-direction: row-reverse; }

/* ============ 404 ============ */
.error-page {
    padding: 90px 0;
    text-align: center;
}
