/* Inisialisasi Font Lokal */
@font-face {
    font-family: 'PixelMplus12';
    src: url('/font/PixelMplus12-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'ZenKakuGothicNew';
    src: url('/font/ZenKakuGothicNew-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

.font-pixel {
    font-family: 'PixelMplus12', 'Courier New', monospace;
}

.font-zen {
    font-family: 'ZenKakuGothicNew', sans-serif;
    font-weight: bold;
}

html,
body {
    background-color: transparent;
    color: #fff;
    overflow-x: hidden;
    width: 100%;
}

/* TOP page (index.html): Lock scroll, allow pinch-zoom */
body.page-top {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
    touch-action: pinch-zoom;
}

body.page-top #main-container {
    overflow: visible !important;
}

/* Sub-pages: Normal scroll with body as scroll container */
body.page-sub {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

body.is-dragging,
body.is-dragging * {
    cursor: move !important;
}

/* -----------------------------------------
           STATE SIDEBAR: DOCKED (HOME / TOP PAGE)
           Tidak bisa di-drag, tetap di kiri
           ----------------------------------------- */
.sidebar-docked {
    position: relative;
    height: 100%;
    flex-shrink: 0;
    background-color: transparent;
    color: #ffffff;
    transition: width 0.3s ease;
    z-index: 50;
}

.sidebar-docked .menu-btn:hover {
    color: #fff;
    transform: translateX(4px);
}

.sidebar-docked .social-icon:hover {
    color: #9b5de5;
}

/* -----------------------------------------
           STATE SIDEBAR: FLOATING (SUB-PAGE DESKTOP)
           Bisa di-drag via header
           ----------------------------------------- */
.sidebar-floating {
    position: fixed;
    background-color: #eadaf5;
    border: 2px solid #9b5de5;
    box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.4);
    color: #000;
    width: 250px !important;
    height: auto !important;
    max-height: 90vh;
    z-index: 999;
    left: 20px;
    top: 20px;
}

.sidebar-floating .docked-only {
    display: none;
}

.sidebar-floating .sidebar-footer {
    display: none !important;
}

.sidebar-floating .menu-btn {
    color: #333;
}

.sidebar-floating .menu-btn:hover {
    color: #9b5de5;
    transform: translateX(4px);
}

.sidebar-floating .docked-border {
    border-color: #9b5de5;
}

.sidebar-floating .social-icon {
    color: #555;
}

.sidebar-floating .social-icon:hover {
    color: #9b5de5;
}

/* Active menu item indicator */
.active-menu {
    color: #9b5de5 !important;
    font-weight: bold;
}

.sidebar-floating .active-menu {
    color: #9b5de5 !important;
}

.sidebar-mobile .active-menu {
    color: #fff !important;
    text-decoration: underline;
}

/* -----------------------------------------
           STATE SIDEBAR: MOBILE MENU (SUB-PAGE HP)
           Slide dari kiri via hamburger
           ----------------------------------------- */
.sidebar-mobile {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px !important;
    height: 100vh !important;
    background-color: #9b5de5;
    color: white;
    z-index: 9999;
    transition: transform 0.3s ease;
    transform: translateX(-100%);
    box-shadow: 4px 0px 15px rgba(0, 0, 0, 0.5);
}

.sidebar-mobile.open {
    transform: translateX(0);
}

.sidebar-mobile .docked-only {
    display: none;
}

.sidebar-mobile .sidebar-footer {
    display: none !important;
}

.sidebar-mobile .menu-btn {
    color: white;
}

.sidebar-mobile .text-gray-400 {
    color: #eadaf5;
}

.sidebar-mobile .docked-border {
    border-top-color: rgba(255, 255, 255, 0.2);
}

.sidebar-mobile .social-icon {
    color: white;
}

/* Mobile overlay backdrop */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    transition: opacity 0.3s ease;
}

.mobile-overlay.hidden {
    display: none;
}

/* -----------------------------------------
           ELEMEN JENDELA & KONTEN (POPUP TOP)
           ----------------------------------------- */
.window-container {
    position: absolute;
    display: flex;
    flex-direction: column;
    box-shadow: 8px 8px 0px rgba(0, 0, 0, 0.5);
    border: 2px solid #fff;
    background: #fff;
    max-width: 90vw;
}

.window-header {
    background-color: #9b5de5;
    color: white;
    padding: 4px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #fff;
    cursor: default;
}

.window-header:hover {
    cursor: move;
}

.window-content {
    background-color: #fff;
    color: #000;
    overflow-y: auto;
}

.zuto-btn {
    background-color: #fff;
    border: 2px solid #9b5de5;
    color: #9b5de5;
    padding: 2px 10px;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.zuto-btn:hover {
    background-color: #9b5de5;
    color: #fff;
}

.custom-scroll::-webkit-scrollbar {
    width: 10px;
}

.custom-scroll::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-left: 1px solid #ccc;
}

.custom-scroll::-webkit-scrollbar-thumb {
    background-color: #9b5de5;
}

/* -----------------------------------------
           LIGHTBOX (GALLERY FULLSCREEN VIEW)
           ----------------------------------------- */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-img-wrap {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-img-wrap img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border: 3px solid #9b5de5;
    box-shadow: 0 0 40px rgba(155, 93, 229, 0.3);
    transition: opacity 0.15s ease;
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    color: white;
    font-size: 28px;
    background: rgba(155, 93, 229, 0.8);
    border: 2px solid white;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.lightbox-close:hover {
    background: #9b5de5;
    transform: scale(1.1);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 24px;
    background: rgba(155, 93, 229, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.5);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.lightbox-nav:hover {
    background: #9b5de5;
    border-color: white;
}

.lightbox-prev {
    left: 16px;
}

.lightbox-next {
    right: 16px;
}

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #9b5de5;
    padding: 4px 16px;
    letter-spacing: 2px;
}

/* -----------------------------------------
           RESPONSIVE: MOBILE (<768px)
           Sub-pages: Sidebar hidden, hamburger visible
           ----------------------------------------- */
@media (max-width: 767px) {

    /* Fix bg-fixed zoom on mobile — mobile browsers don't support background-attachment:fixed properly */
    .bg-fixed {
        background-attachment: scroll !important;
    }

    /* Prevent sidebar scroll on TOP page mobile */
    .sidebar-docked {
        overflow: hidden !important;
    }

    /* Pada sub-page, sidebar floating di-hide, diganti sidebar-mobile */
    .sidebar-floating {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 250px !important;
        height: 100vh !important;
        background-color: #9b5de5;
        color: white;
        z-index: 9999 !important;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 4px 0px 15px rgba(0, 0, 0, 0.5);
        border: none;
        max-height: 100vh;
    }

    .sidebar-floating.open {
        transform: translateX(0);
    }

    .sidebar-floating .menu-btn {
        color: white;
    }

    .sidebar-floating .menu-btn:hover {
        color: #eadaf5;
    }

    .sidebar-floating .active-menu {
        color: #fff !important;
        text-decoration: underline;
    }

    /* Hide desktop sidebar header on mobile, show close btn */
    .sidebar-floating #sidebar-header {
        display: none !important;
    }

    .sidebar-floating #mobile-close-btn {
        display: block !important;
    }
}

/* Desktop (>=768px): sidebar-floating behavior */
@media (min-width: 768px) {
    .sidebar-floating #sidebar-header {
        display: flex !important;
    }

    .sidebar-floating #mobile-close-btn {
        display: none !important;
    }
}