/* ============================================================
   MOBILE SIDE PANEL MENU
   All rules below are scoped to @media (max-width: 991px)
   so the desktop navbar remains completely untouched.
   ============================================================ */

/* ---------- Panel wrapper — fixed viewport clip container ----------
   position:fixed + overflow:hidden is the only cross-browser reliable
   way to prevent the translateX animation from creating a scrollbar.
   pointer-events:none lets clicks through when the panel is closed.
   -------------------------------------------------------------------*/
#mobile-panel-wrapper {
    position: fixed;
    inset: 0;
    /* top/right/bottom/left: 0 */
    overflow: hidden;
    pointer-events: none;
    z-index: 1200;
}

/* Re-enable pointer events for the children */
#mobile-panel-wrapper.is-open {
    pointer-events: auto;
}

/* ---------- Hide default Bootstrap toggler on mobile ---------- */
@media (max-width: 991px) {
    .navbar-collapse {
        display: none !important;
    }
}

/* ---------- Body scroll lock when panel is open ---------- */
body.panel-open {
    overflow: hidden;
}

/* ---------- Hamburger button ---------- */
#mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 1100;
    position: relative;
}

@media (max-width: 991px) {
    #mobile-menu-btn {
        display: flex;
    }
}

.ham-bar {
    display: block;
    width: 26px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1),
        opacity 0.3s ease,
        width 0.3s ease;
    transform-origin: center;
}

/* Morph into X when active */
#mobile-menu-btn.is-active .bar-1 {
    transform: translateY(7px) rotate(45deg);
}

#mobile-menu-btn.is-active .bar-2 {
    opacity: 0;
    width: 0;
}

#mobile-menu-btn.is-active .bar-3 {
    transform: translateY(-7px) rotate(-45deg);
}

/* ---------- Full-screen overlay (inside wrapper, so position:absolute) ---------- */
#mobile-menu-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

#mobile-panel-wrapper.is-open #mobile-menu-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* ---------- Side panel drawer (position:absolute inside clipping wrapper) ---------- */
#mobile-nav-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(320px, 85vw);
    height: 100%;
    background: linear-gradient(160deg, #0d1117 0%, #131c2e 55%, #0d1117 100%);
    border-left: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.45s cubic-bezier(0.77, 0, 0.175, 1);
    overflow: hidden;
    pointer-events: auto;
}

#mobile-panel-wrapper.is-open #mobile-nav-panel {
    transform: translateX(0);
}

/* ---------- Panel header (logo + close btn) ---------- */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.panel-logo img {
    height: 40px;
    width: auto;
    object-fit: contain;
    filter: brightness(1.1);
}

/* Close button (× morphed from two spans) */
#mobile-menu-close {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: background 0.25s ease, transform 0.3s ease;
}

#mobile-menu-close:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: rotate(90deg);
}

#mobile-menu-close span {
    position: absolute;
    width: 16px;
    height: 1.5px;
    background: #fff;
    border-radius: 2px;
}

#mobile-menu-close span:first-child {
    transform: rotate(45deg);
}

#mobile-menu-close span:last-child {
    transform: rotate(-45deg);
}

/* ---------- Navigation area ---------- */
.panel-nav {
    flex: 1;
    padding: 16px 0 8px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Top-level list */
.mobile-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Each nav item — stagger entrance animation */
.mobile-nav-list>li {
    opacity: 0;
    transform: translateX(24px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#mobile-panel-wrapper.is-open .mobile-nav-list>li {
    animation: panelItemIn 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Stagger each top-level item */
#mobile-panel-wrapper.is-open .mobile-nav-list>li:nth-child(1) {
    animation-delay: 0.10s;
}

#mobile-panel-wrapper.is-open .mobile-nav-list>li:nth-child(2) {
    animation-delay: 0.17s;
}

#mobile-panel-wrapper.is-open .mobile-nav-list>li:nth-child(3) {
    animation-delay: 0.24s;
}

#mobile-panel-wrapper.is-open .mobile-nav-list>li:nth-child(4) {
    animation-delay: 0.31s;
}

#mobile-panel-wrapper.is-open .mobile-nav-list>li:nth-child(5) {
    animation-delay: 0.38s;
}

#mobile-panel-wrapper.is-open .mobile-nav-list>li:nth-child(6) {
    animation-delay: 0.45s;
}

#mobile-panel-wrapper.is-open .mobile-nav-list>li:nth-child(7) {
    animation-delay: 0.52s;
}

#mobile-panel-wrapper.is-open .mobile-nav-list>li:nth-child(8) {
    animation-delay: 0.59s;
}

@keyframes panelItemIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Top-level links */
.mobile-nav-list>li>a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 24px;
    color: rgba(255, 255, 255, 0.88) !important;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-decoration: none !important;
    text-transform: uppercase;
    transition: color 0.25s ease, padding-left 0.25s ease;
}

.mobile-nav-list>li>a:hover,
.mobile-nav-list>li.current-menu-item>a,
.mobile-nav-list>li.current-menu-ancestor>a {
    color: #fff !important;
    padding-left: 30px;
}

/* Chevron indicator for parents */
.mobile-nav-list>li.menu-item-has-children>a::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-right: 1.5px solid rgba(255, 255, 255, 0.5);
    border-bottom: 1.5px solid rgba(255, 255, 255, 0.5);
    transform: rotate(45deg);
    margin-right: 4px;
    transition: transform 0.3s ease, border-color 0.3s ease;
    flex-shrink: 0;
}

.mobile-nav-list>li.menu-item-has-children.submenu-open>a::after {
    transform: rotate(-135deg);
    border-color: rgba(255, 255, 255, 0.9);
}

/* Sub-menu (accordion, hidden by default) */
.mobile-nav-list .sub-menu {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0 0 8px 0;
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.mobile-nav-list .sub-menu li a {
    display: block;
    padding: 11px 24px 11px 40px;
    color: rgba(255, 255, 255, 0.65) !important;
    font-size: 13.5px;
    text-decoration: none !important;
    letter-spacing: 0.03em;
    transition: color 0.2s ease, padding-left 0.2s ease;
}

.mobile-nav-list .sub-menu li a:hover {
    color: #fff !important;
    padding-left: 48px;
}

/* Third-level */
.mobile-nav-list .sub-menu .sub-menu li a {
    padding-left: 56px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5) !important;
}

.mobile-nav-list .sub-menu .sub-menu li a:hover {
    padding-left: 62px;
    color: rgba(255, 255, 255, 0.85) !important;
}

/* ---------- Panel footer CTA ---------- */
.panel-footer {
    padding: 20px 24px 28px;
    flex-shrink: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-cta {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    padding: 13px 24px;
    background: linear-gradient(135deg, #c8a96e 0%, #a07840 100%);
    color: #fff !important;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none !important;
    border-radius: 4px;
    transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 4px 18px rgba(168, 120, 60, 0.35);
}

.panel-cta:hover {
    opacity: 0.92;
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(168, 120, 60, 0.5);
}