/* ==========================================================
   LIGHT THEME TOKENS
   ========================================================== */

:root {
    color-scheme: light;

    --site-canvas: #ffffff;

    --site-toggle-bg: #ffffff;
    --site-toggle-bg-hover: #f1f5f9;
    --site-toggle-text: #0f172a;
    --site-toggle-border: #e2e8f0;
    --site-toggle-border-hover: #cbd5e1;
}


/* ==========================================================
   DARK THEME TOKENS
   ========================================================== */

html[data-theme="dark"] {
    color-scheme: dark;

    --theme-palette-color-1: #3b82f6 !important;
    --theme-palette-color-2: #60a5fa !important;
    --theme-palette-color-3: #f8fafc !important;
    --theme-palette-color-4: #94a3b8 !important;
    --theme-palette-color-5: #1e293b !important;
    --theme-palette-color-6: #0f172a !important;
    --theme-palette-color-7: #020617 !important;
    --theme-palette-color-8: #1e293b !important;

    --theme-background-color: #020617 !important;
    --theme-text-color: #f8fafc !important;
    --theme-headings-color: #ffffff !important;

    --site-canvas: #020617;

    --site-toggle-bg: #0f172a;
    --site-toggle-bg-hover: #1e293b;
    --site-toggle-text: #f8fafc;
    --site-toggle-border: #1e293b;
    --site-toggle-border-hover: #334155;
}


/* ==========================================================
   PAGE CANVAS
   Tidak memakai transition agar body tidak tertinggal.
   ========================================================== */

html,
body,
#main-container,
.site-main {
    background-color: var(
        --theme-background-color,
        var(--site-canvas)
    );

    color: var(
        --theme-text-color,
        #0f172a
    );
}

html[data-theme="dark"],
html[data-theme="dark"] body,
html[data-theme="dark"] #main-container,
html[data-theme="dark"] .site-main {
    background-color: #020617 !important;
    color: #f8fafc !important;
}


/* ==========================================================
   BLOCKSY HEADER
   Mencakup desktop, mobile, sticky, dan off-canvas.
   Tidak diberi transition agar berubah bersamaan dengan body.
   ========================================================== */

html[data-theme="dark"] header.site-header,
html[data-theme="dark"] .site-header,
html[data-theme="dark"] .ct-header,
html[data-theme="dark"] .ct-header [data-row],
html[data-theme="dark"] .ct-sticky-container,
html[data-theme="dark"] [data-sticky],
html[data-theme="dark"] .ct-panel,
html[data-theme="dark"] .ct-panel-content,
html[data-theme="dark"] #offcanvas {
    background-color: #020617 !important;
    border-color: #1e293b !important;
}

html[data-theme="dark"] .ct-header [data-id*="menu"] a,
html[data-theme="dark"] .site-title a {
    color: #f8fafc;
}


/* ==========================================================
   ANTI-FLASH
   ========================================================== */

html.theme-preload *,
html.theme-preload *::before,
html.theme-preload *::after {
    transition: none !important;
}


/* ==========================================================
   BLOCKSY CUSTOM HTML WRAPPER
   ========================================================== */

.ct-header-text .entry-content {
    display: flex;
    align-items: center;
    height: 100%;
    margin: 0;
}

.ct-header-text .entry-content > * {
    margin: 0 !important;
}

.theme-switcher-wrapper {
    position: relative;
    z-index: 20;

    display: inline-flex;
    align-items: center;

    margin: 0;
    padding: 0;
}


/* ==========================================================
   THEME BUTTON
   ========================================================== */

.theme-toggle-btn {
    position: relative;
    z-index: 21;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;

    margin: 0;
    padding: 0;

    appearance: none;
    -webkit-appearance: none;

    background-color: var(--site-toggle-bg);
    color: var(--site-toggle-text);

    border: 1px solid var(--site-toggle-border);
    border-radius: 8px;

    box-shadow: none;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;

    transition:
        background-color 180ms ease,
        color 180ms ease,
        border-color 180ms ease,
        transform 180ms ease;
}

.theme-toggle-btn:hover {
    background-color: var(--site-toggle-bg-hover);
    border-color: var(--site-toggle-border-hover);
    transform: translateY(-1px);
}

.theme-toggle-btn:active {
    transform: translateY(0);
}

.theme-toggle-btn:focus-visible {
    outline: 2px solid var(--theme-palette-color-1);
    outline-offset: 3px;
}

.theme-toggle-btn svg {
    display: block;

    width: 18px;
    height: 18px;

    pointer-events: none;
}


/* ==========================================================
   ICON STATES
   ========================================================== */

.theme-toggle-btn .icon-sun {
    display: none;
}

.theme-toggle-btn .icon-moon {
    display: block;
}

html[data-theme="dark"] .theme-toggle-btn .icon-sun {
    display: block;
    color: #f59e0b;
}

html[data-theme="dark"] .theme-toggle-btn .icon-moon {
    display: none;
}


/* ==========================================================
   MOBILE
   ========================================================== */

@media (max-width: 689px) {
    .theme-switcher-wrapper,
    .theme-toggle-btn {
        pointer-events: auto;
    }

    .theme-toggle-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }
}


/* ==========================================================
   ACCESSIBILITY
   ========================================================== */

@media (prefers-reduced-motion: reduce) {
    .theme-toggle-btn {
        transition: none !important;
    }
}