/* shared-nav.css */
/* THE HAMBURGER BUTTON (in-navbar, chameleon) */
.baca-nav-toggle {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    transition: background 0.18s ease, border-color 0.18s ease,
        transform 0.18s ease, color 0.18s ease;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    font-size: 1.05rem;
    line-height: 1;
}

.baca-nav-toggle:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.45);
    color: #10b981;
    transform: scale(1.04);
}

.baca-nav-toggle:active {
    transform: scale(0.94);
}

/* EXPLICIT SVG DIMENSIONS — prevents FOUC of huge icons */
.baca-nav-toggle svg,
.baca-nav-drawer-close svg,
.baca-nav-drawer-link svg,
.baca-nav-drawer-logo svg {
    display: block;
    flex-shrink: 0;
}

.baca-nav-toggle svg {
    width: 20px;
    height: 20px;
}

.baca-nav-drawer-close svg {
    width: 18px;
    height: 18px;
}

.baca-nav-drawer-link svg {
    width: 18px;
    height: 18px;
    opacity: 0.85;
}

.baca-nav-drawer-logo svg {
    width: 30px;
    height: 30px;
}

/* ICON DISPLAY RULES — toggle open/close */
.baca-nav-toggle-icon-open,
.baca-nav-toggle-icon-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    line-height: 0;
}

.baca-nav-toggle-icon-open svg,
.baca-nav-toggle-icon-close svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Default: show open icon, hide close icon */
.baca-nav-toggle .baca-nav-toggle-icon-close {
    display: none !important;
}

.baca-nav-toggle[aria-expanded="true"] .baca-nav-toggle-icon-open {
    display: none !important;
}

.baca-nav-toggle[aria-expanded="true"] .baca-nav-toggle-icon-close {
    display: inline-flex !important;
}

/* LIGHT MODE ADAPTATION */
body.light-mode .baca-nav-toggle {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    color: inherit;
}

body.light-mode .baca-nav-toggle:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.4);
    color: #059669;
}

/* MUSHAF PAGE ADAPTATION */
[data-mushaf-theme="light"] .baca-nav-toggle {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    color: #0f172a;
}

[data-mushaf-theme="light"] .baca-nav-toggle:hover {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

/* SLIDE-IN DRAWER — INITIAL VISIBILITY CONSTRAINTS (FOUC) */
.baca-nav-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 85vw);
    background: #0f172a;
    color: #fff;
    z-index: 10020;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s, opacity 0.3s;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
    font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    /* FOUC: hidden until opened — prevents flash of drawer on load */
    visibility: hidden;
    pointer-events: none;
    opacity: 0;
}

.baca-nav-drawer.open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    opacity: 1;
}

/* Drawer header */
.baca-nav-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(16, 185, 129, 0.04);
    flex-shrink: 0;
}

.baca-nav-drawer-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: #fff;
}

.baca-nav-drawer-logo-text {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.8px;
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 50%, #6366f1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.baca-nav-drawer-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    flex-shrink: 0;
}

.baca-nav-drawer-close:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(16, 185, 129, 0.4);
}

/* Drawer body */
.baca-nav-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.8rem 0.6rem;
    -webkit-overflow-scrolling: touch;
}

.baca-nav-drawer-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    padding: 0.9rem 1rem 0.4rem;
}

.baca-nav-drawer-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.18s, color 0.18s, transform 0.18s;
    margin-bottom: 2px;
}

.baca-nav-drawer-link:hover {
    background: rgba(16, 185, 129, 0.08);
    color: #10b981;
    transform: translateX(2px);
}

.baca-nav-drawer-link:active {
    transform: translateX(2px) scale(0.99);
}

.baca-nav-drawer-link.active {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    font-weight: 600;
}

.baca-nav-drawer-link.active svg {
    opacity: 1;
}

/* Drawer footer */
.baca-nav-drawer-footer {
    padding: 1rem 1.4rem 1.4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

.baca-nav-drawer-footer-text {
    font-size: 0.75rem;
    color: #64748b;
    text-align: center;
    line-height: 1.5;
}

/* BACKDROP — INITIAL VISIBILITY CONSTRAINTS */
.baca-nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    z-index: 10015;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
}

.baca-nav-backdrop.open {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

/* LIGHT MODE DRAWER */
body.light-mode .baca-nav-drawer {
    background: #f8fafc;
    color: #0f172a;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
}

body.light-mode .baca-nav-drawer-head {
    border-bottom-color: rgba(0, 0, 0, 0.07);
    background: rgba(16, 185, 129, 0.04);
}

body.light-mode .baca-nav-drawer-close {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
    color: #0f172a;
}

body.light-mode .baca-nav-drawer-close:hover {
    background: rgba(0, 0, 0, 0.08);
}

body.light-mode .baca-nav-drawer-link {
    color: #475569;
}

body.light-mode .baca-nav-drawer-link:hover {
    background: rgba(16, 185, 129, 0.06);
    color: #059669;
}

body.light-mode .baca-nav-drawer-link.active {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

body.light-mode .baca-nav-drawer-section-label {
    color: #94a3b8;
}

body.light-mode .baca-nav-drawer-footer {
    border-top-color: rgba(0, 0, 0, 0.07);
}

body.light-mode .baca-nav-drawer-footer-text {
    color: #64748b;
}

body.light-mode .baca-nav-drawer-logo {
    color: #0f172a;
}

/* SMALL SCREENS */
@media (max-width: 640px) {
    .baca-nav-toggle {
        width: 40px;
        height: 40px;
    }

    .baca-nav-toggle svg {
        width: 18px;
        height: 18px;
    }

    .baca-nav-toggle-icon-open,
    .baca-nav-toggle-icon-close,
    .baca-nav-toggle-icon-open svg,
    .baca-nav-toggle-icon-close svg {
        width: 18px;
        height: 18px;
    }

    .baca-nav-drawer {
        width: 88vw;
    }
}

/* REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {

    .baca-nav-drawer,
    .baca-nav-backdrop,
    .baca-nav-toggle {
        transition: none !important;
    }
}