/**
 * Indonesia Forum on Labor and Productivity (IFLP) - Accessibility Tools
 * Design direction: Institutional-minimal, clean, sleek, high contrast.
 * WCAG AA compliant. All preferences saved to localStorage.
 */

/* Floating Left Trigger Button */
.nj-acc-trigger {
    position: fixed !important;
    left: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 99999980 !important;
    width: 44px !important;
    height: 48px !important;
    border-radius: 0 10px 10px 0 !important;
    background: var(--nj-primary, #173b5d) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.25) !important;
    border-left: none !important;
    color: #ffffff !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 2px 4px 16px rgba(15, 34, 58, 0.22) !important;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.18s ease, box-shadow 0.18s ease !important;
    outline: none !important;
    padding: 0 !important;
}

.nj-acc-trigger:hover {
    transform: translateY(-50%) translateX(3px) !important;
    background: #1b456e !important;
    box-shadow: 4px 6px 20px rgba(15, 34, 58, 0.3) !important;
}

.nj-acc-trigger:focus-visible {
    outline: 3px solid var(--nj-accent, #f28c28) !important;
    outline-offset: 2px !important;
}

.nj-acc-trigger svg {
    width: 24px !important;
    height: 24px !important;
    fill: #ffffff !important;
}

/* Backdrop Overlay */
.nj-acc-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(15, 23, 42, 0.42) !important;
    backdrop-filter: blur(3px) !important;
    -webkit-backdrop-filter: blur(3px) !important;
    z-index: 99999990 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: opacity 0.24s ease, visibility 0.24s !important;
}

.nj-acc-overlay.is-open {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Sidebar Drawer */
.nj-acc-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 380px !important;
    max-width: 90vw !important;
    height: 100vh !important;
    background: #ffffff !important;
    z-index: 99999995 !important;
    box-shadow: 10px 0 36px rgba(15, 34, 58, 0.2) !important;
    display: flex !important;
    flex-direction: column !important;
    transform: translateX(-100%) !important;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    color: #0f172a !important;
    box-sizing: border-box !important;
}

.nj-acc-sidebar.is-open {
    transform: translateX(0) !important;
}

/* Sidebar Header */
.nj-acc-header {
    flex-shrink: 0 !important;
    background: linear-gradient(135deg, #173b5d 0%, #1e4a78 100%) !important;
    padding: 16px 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
}

.nj-acc-header-info {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.nj-acc-header-icon {
    width: 38px !important;
    height: 38px !important;
    border-radius: 9px !important;
    background: rgba(255, 255, 255, 0.15) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.nj-acc-header-icon svg {
    width: 22px !important;
    height: 22px !important;
    fill: #ffffff !important;
}

.nj-acc-header-titles {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
}

.nj-acc-header-title {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    line-height: 1.2 !important;
    margin: 0 !important;
}

.nj-acc-header-sub {
    font-size: 11.5px !important;
    color: rgba(255, 255, 255, 0.78) !important;
    margin: 0 !important;
    line-height: 1.2 !important;
}

.nj-acc-header-close {
    width: 36px !important;
    height: 36px !important;
    border-radius: 8px !important;
    border: none !important;
    background: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.15s ease, transform 0.15s ease !important;
    padding: 0 !important;
}

.nj-acc-header-close:hover {
    background: rgba(255, 255, 255, 0.22) !important;
    transform: scale(1.05) !important;
}

.nj-acc-header-close:focus-visible {
    outline: 2px solid var(--nj-accent, #f28c28) !important;
}

.nj-acc-header-close svg {
    width: 18px !important;
    height: 18px !important;
    fill: currentColor !important;
}

/* Sidebar Body */
.nj-acc-body {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    padding: 18px 20px 24px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
}

/* Category Sections */
.nj-acc-section {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
}

.nj-acc-section-title {
    font-size: 12px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.6px !important;
    color: #64748b !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.nj-acc-section-title svg {
    width: 14px !important;
    height: 14px !important;
    fill: currentColor !important;
}

/* Font Sizing Controls */
.nj-acc-font-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
}

.nj-acc-font-btn {
    padding: 8px 4px !important;
    border-radius: 8px !important;
    border: 1.5px solid #e2e8f0 !important;
    background: #f8fafc !important;
    color: #173b5d !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    cursor: pointer !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    transition: all 0.15s ease !important;
}

.nj-acc-font-btn span.nj-acc-font-label {
    font-size: 10.5px !important;
    color: #64748b !important;
    font-weight: 500 !important;
}

.nj-acc-font-btn:hover {
    background: #ffffff !important;
    border-color: #173b5d !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 6px rgba(15, 34, 58, 0.08) !important;
}

.nj-acc-font-btn.is-active {
    background: #173b5d !important;
    border-color: #173b5d !important;
    color: #ffffff !important;
    box-shadow: 0 3px 8px rgba(23, 59, 93, 0.22) !important;
}

.nj-acc-font-btn.is-active span.nj-acc-font-label {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Toggle Option Cards Grid */
.nj-acc-toggle-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
}

.nj-acc-card {
    padding: 12px 10px !important;
    border-radius: 9px !important;
    border: 1.5px solid #e2e8f0 !important;
    background: #f8fafc !important;
    color: #1e293b !important;
    cursor: pointer !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
    transition: all 0.16s ease !important;
    position: relative !important;
    text-align: left !important;
}

.nj-acc-card:hover {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 3px 8px rgba(15, 34, 58, 0.06) !important;
}

.nj-acc-card.is-active {
    background: #eff6ff !important;
    border-color: #173b5d !important;
    color: #173b5d !important;
    box-shadow: 0 2px 6px rgba(23, 59, 93, 0.12) !important;
}

.nj-acc-card-top {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
}

.nj-acc-card-icon {
    width: 28px !important;
    height: 28px !important;
    border-radius: 6px !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #173b5d !important;
    transition: all 0.16s ease !important;
}

.nj-acc-card.is-active .nj-acc-card-icon {
    background: #173b5d !important;
    border-color: #173b5d !important;
    color: #ffffff !important;
}

.nj-acc-card-icon svg {
    width: 16px !important;
    height: 16px !important;
    fill: currentColor !important;
}

.nj-acc-card-badge {
    width: 16px !important;
    height: 16px !important;
    border-radius: 50% !important;
    border: 1.5px solid #cbd5e1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #ffffff !important;
    transition: all 0.16s ease !important;
}

.nj-acc-card.is-active .nj-acc-card-badge {
    background: #173b5d !important;
    border-color: #173b5d !important;
}

.nj-acc-card.is-active .nj-acc-card-badge::after {
    content: '' !important;
    width: 6px !important;
    height: 6px !important;
    border-radius: 50% !important;
    background: #ffffff !important;
}

.nj-acc-card-name {
    font-size: 12.5px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    margin: 0 !important;
}

/* Sidebar Footer & Reset Button */
.nj-acc-footer {
    flex-shrink: 0 !important;
    padding: 14px 20px !important;
    background: #f8fafc !important;
    border-top: 1px solid #e2e8f0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
}

.nj-acc-reset-btn {
    width: 100% !important;
    padding: 10px 14px !important;
    border-radius: 8px !important;
    border: 1.5px solid #cbd5e1 !important;
    background: #ffffff !important;
    color: #475569 !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    transition: all 0.16s ease !important;
}

.nj-acc-reset-btn svg {
    width: 14px !important;
    height: 14px !important;
    fill: currentColor !important;
}

.nj-acc-reset-btn:hover {
    background: #f1f5f9 !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
}

.nj-acc-reset-btn:focus-visible {
    outline: 2px solid var(--nj-accent, #f28c28) !important;
}

.nj-acc-note {
    font-size: 11px !important;
    color: #94a3b8 !important;
    text-align: center !important;
    margin: 0 !important;
    line-height: 1.3 !important;
}

/* Reading Guide Horizontal Ruler */
.nj-acc-reading-ruler {
    position: fixed !important;
    left: 0 !important;
    width: 100vw !important;
    height: 36px !important;
    background: rgba(242, 140, 40, 0.12) !important;
    border-top: 2px solid var(--nj-accent, #f28c28) !important;
    border-bottom: 2px solid var(--nj-accent, #f28c28) !important;
    box-shadow: 0 0 14px rgba(242, 140, 40, 0.25) !important;
    pointer-events: none !important;
    z-index: 999999 !important;
    display: none !important;
    transform: translateY(-50%) !important;
}

.nj-acc-reading-ruler.is-active {
    display: block !important;
}

/* ==========================================================================
   Global Accessibility Accommodations (Applied via classes on html)
   ========================================================================== */

/* Font Sizing Root and Body Scalers */
html.nj-acc-font-sm {
    font-size: 14px !important;
}

html.nj-acc-font-lg {
    font-size: 18.5px !important;
}

html.nj-acc-font-xl {
    font-size: 21px !important;
}

html.nj-acc-font-sm body {
    font-size: 12.5px !important;
}

html.nj-acc-font-lg body {
    font-size: 16.5px !important;
    line-height: 1.5 !important;
}

html.nj-acc-font-xl body {
    font-size: 18.5px !important;
    line-height: 1.6 !important;
}

/* Dyslexia-Friendly Font */
html.nj-acc-dyslexic,
html.nj-acc-dyslexic body,
html.nj-acc-dyslexic p,
html.nj-acc-dyslexic h1,
html.nj-acc-dyslexic h2,
html.nj-acc-dyslexic h3,
html.nj-acc-dyslexic h4,
html.nj-acc-dyslexic h5,
html.nj-acc-dyslexic h6,
html.nj-acc-dyslexic a,
html.nj-acc-dyslexic span,
html.nj-acc-dyslexic li {
    font-family: "OpenDyslexic", "Comic Sans MS", "Trebuchet MS", Verdana, sans-serif !important;
    letter-spacing: 0.035em !important;
}

/* Text and Line Spacing */
html.nj-acc-spacing body,
html.nj-acc-spacing p,
html.nj-acc-spacing li {
    line-height: 1.85 !important;
    letter-spacing: 0.08em !important;
    word-spacing: 0.15em !important;
}

/* High Contrast Mode */
html.nj-acc-contrast {
    background: #000000 !important;
    color: #ffffff !important;
}

html.nj-acc-contrast body,
html.nj-acc-contrast .pkp_structure_page,
html.nj-acc-contrast .pkp_structure_main,
html.nj-acc-contrast .nj_masthead,
html.nj-acc-contrast .nj_footer {
    background: #000000 !important;
    color: #ffffff !important;
}

html.nj-acc-contrast a {
    color: #facc15 !important;
    text-decoration: underline !important;
}

html.nj-acc-contrast button,
html.nj-acc-contrast input,
html.nj-acc-contrast select {
    border-color: #ffffff !important;
}

/* Invert / Dark Reading Mode */
html.nj-acc-dark {
    filter: invert(0.92) hue-rotate(180deg) !important;
    background: #ffffff !important;
}

/* Exclude media, SVGs, and floating widgets from double inversion */
html.nj-acc-dark img,
html.nj-acc-dark video,
html.nj-acc-dark iframe,
html.nj-acc-dark canvas,
html.nj-acc-dark .njcb-trigger,
html.nj-acc-dark .nj-faq-trigger,
html.nj-acc-dark .njcb-panel,
html.nj-acc-dark .nj-faq-panel,
html.nj-acc-dark .nj-scroll-top,
html.nj-acc-dark .nj-acc-trigger,
html.nj-acc-dark .nj-acc-sidebar,
html.nj-acc-dark .nj-acc-reading-ruler {
    filter: invert(1) hue-rotate(180deg) !important;
}

/* Monochrome / Grayscale */
html.nj-acc-grayscale {
    filter: grayscale(100%) !important;
}

html.nj-acc-grayscale .nj-acc-sidebar,
html.nj-acc-grayscale .nj-acc-trigger {
    filter: none !important;
}

/* Sepia / Soft Reading Mode */
html.nj-acc-sepia {
    filter: sepia(45%) brightness(96%) !important;
}

html.nj-acc-sepia .nj-acc-sidebar,
html.nj-acc-sepia .nj-acc-trigger {
    filter: none !important;
}

/* Highlight Links */
html.nj-acc-highlight-links a {
    text-decoration: underline 2.5px var(--nj-primary, #173b5d) !important;
    text-underline-offset: 4px !important;
    background-color: rgba(242, 140, 40, 0.16) !important;
    border-radius: 2px !important;
    font-weight: 600 !important;
    padding: 0 2px !important;
}

/* Big Cursor */
html.nj-acc-big-cursor,
html.nj-acc-big-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 24 24' fill='%23173b5d' stroke='%23ffffff' stroke-width='1.5'%3E%3Cpath d='M3 3l7 18 3-7 7-3L3 3z'/%3E%3C/svg%3E"), auto !important;
}

html.nj-acc-big-cursor a,
html.nj-acc-big-cursor button,
html.nj-acc-big-cursor [role="button"],
html.nj-acc-big-cursor input,
html.nj-acc-big-cursor textarea {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 24 24' fill='%23f28c28' stroke='%23ffffff' stroke-width='1.5'%3E%3Cpath d='M3 3l7 18 3-7 7-3L3 3z'/%3E%3C/svg%3E"), pointer !important;
}

/* Pause Animations (Prefers Reduced Motion Accommodation) */
html.nj-acc-pause-animations *,
html.nj-acc-pause-animations *::before,
html.nj-acc-pause-animations *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
    scroll-behavior: auto !important;
}

/* Mobile Responsiveness for Sidebar */
@media (max-width: 520px) {
    .nj-acc-trigger {
        width: 38px !important;
        height: 42px !important;
    }

    .nj-acc-trigger svg {
        width: 20px !important;
        height: 20px !important;
    }

    .nj-acc-sidebar {
        width: 100vw !important;
        max-width: 100vw !important;
    }

    .nj-acc-toggle-grid {
        grid-template-columns: 1fr !important;
    }
}
