/* ==== 1. VARIABEL GLOBAL & DASAR ==== */
:root {
    --bg-light: #f9f9fb;
    --bg-dark: #121212;
    --text-light: #222;
    --text-dark: #eee;
    --card-light: #fff;
    --card-dark: #1e1e1e;
    --accent: #888888;
    --accent-gradient: linear-gradient(135deg, #d9d9d9, #888888);
    --btn-text: #000;
}

html,
body {
    min-height: 100vh;
    /* overflow-x: hidden; */
    /* Dihapus: Ini mengganggu position:sticky */
}

body {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    background: var(--bg-light);
    color: var(--text-light);
    transition: .3s;
}

body.dark {
    background: var(--bg-dark);
    color: var(--text-dark);
}

/* ==== 2. HEADER & NAVIGASI (DESKTOP) ==== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, .7);
    /* backdrop-filter: blur(12px); */
    /* Dihapus: Ini mengganggu FAB position:fixed */
    position: sticky;
    /* Diubah kembali ke sticky: ini solusi terbaik untuk header dinamis */
    top: 0;
    z-index: 1000;
    /* Naikkan z-index agar di atas search wrap */
    border-bottom: 2px solid rgba(0, 0, 0, 0.15);
}

body.dark header {
    background: rgba(18, 18, 18, .8);
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}

/* Supaya konten tidak tertimpa header sticky */
main {
    padding: 1.5rem;
    max-width: 800px;
    margin: auto;
    /* Hapus padding-top: 90px !important; 'sticky' akan menanganinya */
}

/* Tablet – sedikit lebih lebar */
@media (min-width: 768px) {
    main {
        max-width: 900px;
    }
}

/* Desktop – lebih ramping tapi tetap lega */
@media (min-width: 800px) {
    main {
        max-width: 960px;
    }
}

header h2 {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    /* senada dengan body */
    font-weight: 00;
    letter-spacing: 0.5px;
    font-size: 1.35rem;
    /* lebih besar */
    text-transform: uppercase;
    /* jadi LKS TRIPARTIT NASIONAL */
}


.header-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.header-icons {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Navigasi Desktop (Scrollable) */
header nav {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
    /* Firefox */
    scrollbar-color: var(--accent) transparent;
    -webkit-overflow-scrolling: touch;
}

header nav::-webkit-scrollbar {
    height: 6px;
}

header nav::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

header nav::-webkit-scrollbar-track {
    background: transparent;
}

header nav a {
    padding: .4rem 1rem;
    border-radius: 12px;
    font-weight: 500;
    text-decoration: none;
    color: inherit;
    transition: background .2s, color .2s;
    flex: 0 0 auto;
    /* Biar tidak geser aneh saat scroll */
}

header nav a.active,
header nav a:hover {
    background: var(--accent);
    color: var(--btn-text);
}

/* Hamburger (Sembunyi di Desktop) */
.hamburger {
    display: none;
    width: 26px;
    height: 20px;
    position: relative;
    cursor: pointer;
    z-index: 2001;
    /* Di atas nav overlay */
}

.hamburger span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px;
    background: currentColor;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger span:nth-child(1) {
    top: 0;
}

.hamburger span:nth-child(2) {
    top: 8px;
    /* Ubah: penyesuaian posisi */
}

.hamburger span:nth-child(3) {
    bottom: 0;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg);
    top: 7px;
    /* Ubah: penyesuaian posisi */
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg);
    bottom: 7px;
    /* Ubah: penyesuaian posisi */
}

/* Overlay (Sembunyi di Desktop) */
#navOverlay {
    display: none;
}


/* ==== 3. TOMBOL & SEARCH ==== */

.search-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
    background: var(--card-light);
    user-select: none;
    font-size: 1rem;
}

body.dark .search-toggle {
    background: var(--card-dark);
    color: #fff;
}

.theme-toggle {
    position: fixed;
    bottom: 15px;
    right: 10px;
    background: var(--card-light);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
    z-index: 2000;
}

/* ==== Tombol WhatsApp Floating ==== */
.wa-floating {
    position: fixed;
    bottom: 10px;
    left: 10px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 2000;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));

    /* animasi awal tersembunyi */
    opacity: 0;
    transform: translateX(-60px);
    transition: transform 1s ease, opacity 1s ease;
}

/* Saat sudah muncul (setelah 8 detik via JS) */
.wa-floating.show {
    opacity: 1;
    transform: translateX(0);
}

/* Efek hover */
.wa-floating:hover {
    transform: translateX(0) scale(1.1);
}

/* Desktop: ikon lebih besar */
@media (min-width: 900px) {
    .wa-floating {
        width: 80px;
        height: 80px;
        bottom: 15px;
        left: 10px;
    }
}

body.dark .theme-toggle {
    background: var(--card-dark);
    color: #fff;
}

#searchBarWrap {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(-8px);
    transition: max-height .28s ease, opacity .28s ease, transform .28s ease, padding .28s ease;
    padding: 0 1.5rem;
    max-width: 800px;
    margin: auto;
    position: relative;
    /* Tambahkan ini agar z-index bekerja */
    z-index: 1001;
    /* Perbaikan: Naikkan z-index agar di ATAS header (sebelumnya 999) */
}

#searchBarWrap.open {
    max-height: 120px;
    opacity: 1;
    transform: translateY(0);
    padding: .6rem 1.5rem 0;
}

#searchInput {
    width: 100%;
    padding: .7rem .95rem;
    border: 1px solid #ddd;
    border-radius: 16px;
    outline: none;
    background: var(--card-light);
    color: inherit;
    font-family: inherit;
    font-size: .95rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .06);
}

body.dark #searchInput {
    background: var(--card-dark);
    border-color: #333;
    color: var(--text-dark);
}

/* ==== 4. KONTEN (CARD, DLL) ==== */
.card {
    background: var(--card-light);
    margin-bottom: 1.2rem;
    border-radius: 18px;
    padding: 1.2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .05);
}

body.dark .card {
    background: var(--card-dark);
}

.card h3 {
    margin: .3rem 0;
}

.card p {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.date {
    font-size: .85rem;
    color: #777;
    margin-bottom: .6rem;
}

body.dark .date {
    color: #aaa;
}

.doc-info {
    font-size: .9rem;
    color: #888;
    margin-top: .5rem;
    margin-bottom: .8rem;
    display: flex;
    align-items: center;
    gap: .3rem;
}

body.dark .doc-info {
    color: #aaa;
}

.btn {
    display: inline-block;
    padding: .55rem 1.2rem;
    border-radius: 14px;
    background: var(--accent-gradient);
    color: var(--btn-text);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
    transition: transform .2s;
}

.btn:hover {
    transform: scale(1.05);
}

#loadMoreBtn {
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 10px;
}

.thumb {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: .8rem;
}

.struktur-card img.thumb {
    max-height: 300px;
    object-fit: contain;
    background: #fafafa;
    padding: 0.5rem;
}

body.dark .struktur-card img.thumb {
    background: #1a1a1a;
}

.no-results {
    padding: 1rem;
    text-align: center;
    opacity: .7
}

/* ==== 5. SITE LOGO & TITLE ==== */
.site-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.site-title img.site-logo {
    height: 70px;
    /* sebelumnya 50px */
    width: auto;
    border-radius: 6px;
    vertical-align: middle;
    object-fit: contain;
}


/* ==== 6. FOOTER & LOADER ==== */
footer {
    text-align: center;
    padding: 1rem;
    font-size: .9rem;
    opacity: .7;
}

#cacheStatus {
    position: fixed;
    bottom: 10px;
    left: 20px;
    font-size: .8rem;
    opacity: .6;
}

#loadingOverlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, .85);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    color: #333;
    z-index: 3000;
}

body.dark #loadingOverlay {
    background: rgba(18, 18, 18, .85);
    color: #eee;
}

.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ======================================================= */
/* === MEDIA QUERIES (RESPONSIVE) === */
/* ======================================================= */
@media (max-width: 900px) {

    /* Ubah site title jadi vertikal di tablet */
    .site-title {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.3rem;
    }

    .site-title img.site-logo {
        height: 60px;
    }

    .site-title span {
        display: block;
        font-size: 1rem;
        line-height: 1.2;
        margin-top: 0.6rem;
    }
}

/* ======================================================= */
/* === MEDIA QUERIES (MOBILE) === */
/* ======================================================= */

@media (max-width: 600px) {

    /* --- Header & Main --- */
    header {
        padding: .6rem 1rem .4rem;
        /* DIUBAH: Padding dikecilkan agar header lebih pendek */
        gap: .3rem;
        justify-content: center;
        /* Tambahkan ini untuk memusatkan logo */
    }

    /* Padding atas untuk main disesuaikan lagi */
    main {
        padding: 1rem;
        /* Hapus padding-top: 70px !important; 'sticky' akan menanganinya */
    }

    header h2 {
        font-size: 1.2rem;
        margin-bottom: 0;
    }

    /* Tampilkan Hamburger */
    .hamburger {
        display: block;
        /* Tampilkan di mobile */
        /* Hapus flex dan properti terkait */

        /* Properti FAB */
        position: fixed;
        top: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        padding: 10px;
        box-sizing: border-box;
        background: var(--card-light);
        border-radius: 50%;
        box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
        z-index: 2001;
        /* PERBAIKAN: Naikkan agar di atas 'nav' (2000) */
    }

    body.dark .hamburger {
        background: var(--card-dark);
    }

    /* Pindahkan span hamburger ke tengah */
    .hamburger span {
        height: 6px;
        /* DIUBAH: dari 2px (tinggi dot) */
        width: 6px;
        /* DIUBAH: dari 20px (lebar dot) */
        border-radius: 50%;
        /* DIUBAH: buat jadi bulat */
        /* Hapus top/bottom dari base */
        /* 'transition' properti sudah ada di base rule */
    }

    .hamburger span:nth-child(1) {
        top: 10px;
        /* DIUBAH: Posisi dot 1 */
        width: 6px;
        /* DIUBAH: pastikan dot */
        left: 50%;
        transform: translateX(-50%);
    }

    .hamburger span:nth-child(2) {
        top: 18px;
        /* DIUBAH: Posisi dot 2 */
        width: 6px;
        /* DIUBAH: pastikan dot */
        left: 50%;
        transform: translateX(-50%);
    }

    .hamburger span:nth-child(3) {
        top: 26px;
        /* DIUBAH: Posisi dot 3 */
        width: 6px;
        /* DIUBAH: pastikan dot */
        left: 50%;
        transform: translateX(-50%);
        bottom: auto;
        /* Override base 'bottom' */
    }

    .hamburger.active span:nth-child(1) {
        top: 18px;
        /* DIUBAH: Paskan ke tengah (posisi X) */
        height: 2px;
        /* DIUBAH: kembali jadi garis */
        width: 20px;
        /* DIUBAH: memanjang jadi garis */
        border-radius: 2px;
        /* DIUBAH: kembali jadi kotak */
        transform: translateX(-50%) rotate(45deg);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        top: 18px;
        /* DIUBAH: Paskan ke tengah (posisi X) */
        height: 2px;
        /* DIUBAH: kembali jadi garis */
        width: 20px;
        /* DIUBAH: memanjang jadi garis */
        border-radius: 2px;
        /* DIUBAH: kembali jadi kotak */
        transform: translateX(-50%) rotate(-45deg);
        bottom: auto;
    }


    /* --- Navigasi --- */
    header nav {
        position: fixed;
        top: 65px;
        left: 50%;
        transform: translateX(-50%) translateY(-20px);
        width: 90%;
        max-width: 340px;

        flex-direction: column;
        align-items: stretch;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(16px);
        border-radius: 16px;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
        padding: 1rem;
        z-index: 2000;

        /* Sembunyikan (mirip search bar) */
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, opacity 0.3s ease, transform 0.3s ease;

        /* Override setelan desktop */
        white-space: normal;
    }

    /* Terapkan .open ke 'header nav' juga */
    header nav.open {
        max-height: 500px;
        /* Cukup besar untuk menampung link */
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    body.dark header nav {
        background: rgba(18, 18, 18, 0.96);
    }

    /* Link di dalam Nav Mobile */
    header nav a {
        text-align: left;
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
        flex: 1 1 auto;
        /* Kembalikan ke flex normal */
    }

    /* --- Overlay Latar Belakang Nav --- */
    #navOverlay {
        display: none;
        /* Ubah: Tidak perlu overlay lagi */
    }

    #navOverlay.show {
        opacity: 0;
        pointer-events: none;
        /* Ubah: Tidak perlu overlay lagi */
    }

    /* --- Tombol Floating (Search & Theme) --- */

    /* Jadikan search-toggle sebagai FAB */
    .search-toggle {
        position: fixed !important;
        top: 20px;
        left: 20px !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 1.2rem !important;
        z-index: 2000 !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, .2) !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    body.dark .search-toggle {
        background: var(--card-dark) !important;
        color: var(--text-dark);
    }

    /* Sesuaikan posisi theme-toggle */
    .theme-toggle {
        right: 10px !important;
        bottom: 10px !important;
        width: 40px !important;
        height: 40px !important;
    }

    .site-title img.site-logo {
        height: 60px;
    }
}

/* ======================================================= */
/* === MEDIA QUERIES (MOBILE KECIL) === */
/* ======================================================= */
@media (max-width: 480px) {
    .site-title {
        gap: 0.5rem;
    }

    .site-title img.site-logo {
        height: 18vw;
        /* Ukuran logo responsif */
    }

    .site-title span {
        font-size: 0.95rem;
        margin-top: 0.6rem;
    }

}

/* ==== Gradien Lembut Latar Belakang Dinamis ==== */
body {
    background: linear-gradient(180deg,
            color-mix(in srgb, var(--accent2) 10%, #ffffff) 0%,
            color-mix(in srgb, var(--accent) 5%, #f9fafc) 40%,
            color-mix(in srgb, var(--accent2) 8%, #eef3f8) 100%);
    background-attachment: fixed;
    color: var(--text-light);
    transition: background 0.6s ease, color 0.3s ease;
}

/* Mode gelap: tetap gunakan nuansa tema tapi lebih gelap */
body.dark {
    background: linear-gradient(180deg,
            color-mix(in srgb, var(--accent) 25%, #0f172a) 0%,
            color-mix(in srgb, var(--accent2) 20%, #1e293b) 50%,
            color-mix(in srgb, var(--accent) 15%, #334155) 100%);
    color: var(--text-dark);
}

/* Cahaya lembut kanan bawah menyesuaikan warna tema */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background: radial-gradient(circle at 80% 100%,
            color-mix(in srgb, var(--accent) 25%, transparent),
            transparent 70%);
    opacity: 0.6;
    filter: blur(40px);
    transition: background 0.6s ease, opacity 0.4s ease;
}

/* ==== Footer Netral dari Gradasi ==== */
footer {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    color: var(--text-light);
    position: relative;
    z-index: 10;
}

body.dark footer {
    background: rgba(18, 18, 18, 0.9);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-dark);
}

/* ==== Warna Ikon Sosial Adaptif ==== */
:root {
    --icon-email: #003366;
    /* biru tua Tripnas */
    --icon-instagram: #c13584;
    /* magenta khas Instagram */
    --icon-tiktok: #010101;
    /* hitam TikTok */
}

body.dark {
    --icon-email: #5ea6ff;
    /* biru lembut agar terlihat di dark mode */
    --icon-instagram: #ff77c7;
    /* pink terang */
    --icon-tiktok: #ffffff;
    /* putih agar tetap jelas */
}

/* ==== Efek Hover & Transisi Ikon Sosial Footer ==== */
footer svg {
    opacity: 0.9;
    transition: opacity 0.3s ease, transform 0.3s ease, fill 0.4s ease;
}

footer a:hover svg {
    transform: scale(1.15);
    opacity: 1;
}

footer a:focus-visible svg {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

/* Desktop natural wrap */
.site-title {
    flex-wrap: wrap !important;
}

/* Saat sejajar dengan logo → teks wajib utuh */
.site-title span {
    white-space: nowrap !important;
}

/* FORCE: Jika layar < 1200px, logo dan teks SELALU vertikal */
@media (max-width: 1200px) {
    .site-title {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        flex-wrap: nowrap !important;
        gap: .4rem !important;
    }

    .site-title span {
        display: block !important;
        width: 100% !important;
        white-space: normal !important;
        text-align: center !important;
        margin-top: .4rem !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

}