/* ═══════════════════════════════════════════════════════════════
   Axis Puls — Hub Menu (landing header)
   Chic glass menu button + side drawer with the 6 module hubs.
   Matches the site theme (dark/light) via CSS vars from home.css/main.css.
   ═══════════════════════════════════════════════════════════════ */

/* ── Header start cluster (menu button + brand, edge side) ────── */
.nav-start {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

/* Narrow phones: keep logo + menu on ONE row — hide the wordmark,
   keep the logo mark, so the cluster never wraps under itself. */
@media (max-width: 560px) {
    .nav-start {
        gap: 8px;
    }
    .nav-start .nav-title {
        display: none;
    }
    .nav-actions {
        gap: 8px;
    }
    .hub-menu-btn {
        padding: 9px 12px;
    }
}

/* ── Menu button ───────────────────────────────────────────────
   Restrained glass pill: hairline border, single accent on hover, no
   shine sweep or glow pulse. */
.hub-menu-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    border-radius: 12px;
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.14));
    background: var(--glass, rgba(255, 255, 255, 0.05));
    color: var(--text, #fff);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 0;
    white-space: nowrap;
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: border-color .22s ease, background .22s ease,
        transform .22s ease, box-shadow .25s ease;
    flex-shrink: 0;
}
.hub-menu-btn:hover {
    border-color: rgba(165, 110, 255, 0.5);
    background: rgba(165, 110, 255, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}
.hub-menu-btn:active { transform: scale(.97); }

/* refined hamburger lines → X */
.hub-burger {
    position: relative;
    width: 18px;
    height: 12px;
    flex-shrink: 0;
    opacity: 0.92;
}
.hub-burger span {
    position: absolute;
    inset-inline: 0;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform .28s cubic-bezier(.25,1,.5,1), opacity .18s ease, top .28s ease;
}
.hub-burger span:nth-child(1) { top: 0; }
.hub-burger span:nth-child(2) { top: 5px; }
.hub-burger span:nth-child(3) { top: 10px; }
.hub-menu-btn[aria-expanded="true"] .hub-burger span:nth-child(1) {
    top: 5px;
    transform: rotate(45deg);
}
.hub-menu-btn[aria-expanded="true"] .hub-burger span:nth-child(2) { opacity: 0; }
.hub-menu-btn[aria-expanded="true"] .hub-burger span:nth-child(3) {
    top: 5px;
    transform: rotate(-45deg);
}
.hub-menu-btn .hub-btn-text { position: relative; z-index: 1; }

/* ── Overlay ─────────────────────────────────────────────────── */
.hub-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(2, 8, 16, .62);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
}
.hub-overlay.open { opacity: 1; pointer-events: auto; }

/* ── Drawer panel (slides from inline-start = right in RTL) ──── */
.hub-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    inset-inline-start: 0;
    z-index: 2001;
    width: min(430px, 94vw);
    display: flex;
    flex-direction: column;
    background: var(--bg-2, rgba(9, 26, 38, .96));
    border-inline-end: 1px solid var(--border-glass, rgba(255,255,255,.1));
    box-shadow: -20px 0 60px rgba(0,0,0,.45);
    transform: translateX(105%);
    transition: transform .38s cubic-bezier(.22,1,.36,1);
    overflow: hidden;
}
[dir="ltr"] .hub-drawer { transform: translateX(-105%); box-shadow: 20px 0 60px rgba(0,0,0,.45); }
.hub-drawer.open { transform: translateX(0); }

/* Closed drawer must never paint, catch clicks/keys, or appear when the
   page is panned horizontally (mobile overflow): hide it outright. */
.hub-drawer { visibility: hidden; }
.hub-drawer.open { visibility: visible; }

.hub-drawer::before {
    content: "";
    position: absolute;
    top: -90px;
    inset-inline-start: -70px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(165,110,255,.28), transparent 70%);
    pointer-events: none;
}
.hub-drawer::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    top: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #A56EFF 25%, #63D8FF 50%, #E36AF8 75%, transparent);
    background-size: 200% 100%;
    animation: hubFlow 5s linear infinite;
}
@keyframes hubFlow { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.hub-drawer-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: calc(18px + env(safe-area-inset-top, 0px)) 20px 16px;
    border-bottom: 1px solid var(--border-glass, rgba(255,255,255,.08));
    position: relative;
    z-index: 1;
}
.hub-drawer-logo {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    font-size: 22px;
    background: linear-gradient(135deg, rgba(165,110,255,.3), rgba(99,216,255,.18));
    border: 1px solid rgba(165,110,255,.4);
    flex-shrink: 0;
}
.hub-drawer-title { flex: 1; min-width: 0; }
.hub-drawer-title b { display: block; font-size: 16px; font-weight: 850; color: var(--text, #fff); }
.hub-drawer-title small { display: block; font-size: 12px; color: var(--text-muted, #9fb0c3); margin-top: 2px; }
.hub-drawer-close {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--border-glass, rgba(255,255,255,.1));
    background: var(--glass, rgba(255,255,255,.05));
    color: var(--text, #fff);
    font-size: 16px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background .2s ease, transform .2s ease;
    flex-shrink: 0;
}
.hub-drawer-close:hover { background: var(--glass-hover, rgba(255,255,255,.1)); transform: scale(1.06); }

.hub-drawer-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 16px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 1;
}

/* hub cards */
.hub-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px 16px;
    border-radius: 18px;
    text-decoration: none;
    color: var(--text, #fff);
    background: var(--glass, rgba(255,255,255,.045));
    border: 1px solid var(--border-glass, rgba(255,255,255,.09));
    overflow: hidden;
    transition: transform .22s cubic-bezier(.25,1,.5,1), border-color .22s ease, background .22s ease, box-shadow .25s ease;
    animation: hubCardIn .45s cubic-bezier(.22,1,.36,1) both;
}
.hub-drawer.open .hub-card:nth-child(1) { animation-delay: .04s; }
.hub-drawer.open .hub-card:nth-child(2) { animation-delay: .08s; }
.hub-drawer.open .hub-card:nth-child(3) { animation-delay: .12s; }
.hub-drawer.open .hub-card:nth-child(4) { animation-delay: .16s; }
.hub-drawer.open .hub-card:nth-child(5) { animation-delay: .20s; }
.hub-drawer.open .hub-card:nth-child(6) { animation-delay: .24s; }
@keyframes hubCardIn {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.hub-card::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 12px;
    bottom: 12px;
    width: 3.5px;
    border-radius: 99px;
    background: var(--hub-accent, #A56EFF);
    box-shadow: 0 0 12px var(--hub-accent, #A56EFF);
    opacity: .9;
}
.hub-card:hover {
    transform: translateY(-2px);
    border-color: var(--hub-accent, #A56EFF);
    background: var(--glass-hover, rgba(255,255,255,.08));
    box-shadow: 0 10px 28px rgba(0,0,0,.3), 0 0 0 1px var(--hub-accent, #A56EFF);
}
.hub-card:active { transform: scale(.98); }
.hub-emoji {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 15px;
    display: grid;
    place-items: center;
    font-size: 24px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--hub-accent, #A56EFF) 26%, transparent), rgba(255,255,255,.04));
    border: 1px solid color-mix(in srgb, var(--hub-accent, #A56EFF) 40%, transparent);
}
.hub-card-text { flex: 1; min-width: 0; }
.hub-card-num {
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--hub-accent, #A56EFF);
}
.hub-card-title { font-size: 15px; font-weight: 800; margin-top: 1px; }
.hub-card-desc { font-size: 12px; color: var(--text-muted, #9fb0c3); margin-top: 3px; line-height: 1.7; }
.hub-card-arrow {
    flex-shrink: 0;
    font-size: 18px;
    color: var(--hub-accent, #A56EFF);
    transition: transform .22s ease;
}
.hub-card:hover .hub-card-arrow { transform: translateX(-5px); }
[dir="ltr"] .hub-card:hover .hub-card-arrow { transform: translateX(5px); }

.hub-drawer-foot {
    padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border-glass, rgba(255,255,255,.08));
    position: relative;
    z-index: 1;
}
.hub-login-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px;
    border-radius: 14px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #A56EFF, #6a2ff0);
    box-shadow: 0 6px 22px rgba(165,110,255,.4);
    transition: transform .22s ease, box-shadow .25s ease;
}
.hub-login-link:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(165,110,255,.55); }

/* light theme tuning */
[data-theme="light"] .hub-overlay { background: rgba(15, 23, 42, .45); }
[data-theme="light"] .hub-drawer { background: rgba(255,255,255,.97); box-shadow: -16px 0 48px rgba(15,23,42,.14); }

/* small screens */
@media (max-width: 480px) {
    .hub-menu-btn { padding: 9px 14px 9px 12px; font-size: 13px; }
    .hub-menu-btn .hub-btn-text { display: none; }
    .hub-menu-btn { padding: 10px 12px; }
    .hub-card-desc { display: none; }
    .hub-card { padding: 12px 14px; }
    .hub-emoji { width: 42px; height: 42px; font-size: 21px; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
    .hub-menu-btn::after, .hub-drawer::after, .hub-card { animation: none !important; }
    .hub-drawer, .hub-card, .hub-menu-btn { transition: none !important; }
}
