/* JexMac — shared base styles (nav, footer, tokens, buttons) */

:root {
            /* Tech accent palette */
            --bg-dark: #050914;
            --bg-panel: rgba(13, 19, 36, 0.6);
            --neon-blue: #00f0ff;
            --neon-purple: #8a2be2;
            --text-main: #e2e8f0;
            --text-muted: #94a3b8;
            --border-glow: rgba(0, 240, 255, 0.3);
            
            /* Typography */
            --font-tech: 'Orbitron', sans-serif;
            --font-body: 'Inter', sans-serif;
            --font-code: 'Roboto Mono', monospace;
            
            /* Layout dimensions and spacing */
            --max-width: 1400px;
            --header-height: 96px;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        html {
            scroll-behavior: smooth;
            overflow-x: clip;
        }

        body {
            background-color: var(--bg-dark);
            color: var(--text-main);
            font-family: var(--font-body);
            line-height: 1.6;
            overflow-x: clip;
            background-image: 
                radial-gradient(circle at 15% 50%, rgba(0, 240, 255, 0.05), transparent 25%),
                radial-gradient(circle at 85% 30%, rgba(138, 43, 226, 0.05), transparent 25%);
        }

        /* Animated grid background */
        .grid-bg {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background-image: 
                linear-gradient(rgba(0, 240, 255, 0.03) 1px, transparent 1px),
                linear-gradient(90deg, rgba(0, 240, 255, 0.03) 1px, transparent 1px);
            background-size: 40px 40px;
            z-index: -2;
            pointer-events: none;
        }

        a { text-decoration: none; color: inherit; }
        ul { list-style: none; }
        
        .container {
            max-width: var(--max-width);
            margin: 0 auto;
            padding: 0 24px;
        }

        /* Scroll-reveal hidden state */
        .reveal {
            opacity: 0;
            transform: translateY(60px);
            transition: all 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
        }
        .reveal.active {
            opacity: 1;
            transform: translateY(0);
        }

        /* Site navigation */
        #main-nav {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: var(--header-height);
            background: rgba(5, 9, 20, 0.8);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            border-bottom: 1px solid rgba(0, 240, 255, 0.1);
            z-index: 1000;
            display: flex;
            align-items: center;
        }

        #main-nav .container {
            width: 100%;
            height: 100%;
        }

        .nav-container {
            display: grid;
            /* Main nav grows; toolbar keeps lang + auth controls on the right */
            grid-template-columns: minmax(0, 1fr) auto;
            align-items: center;
            width: 100%;
            height: 100%;
            position: relative;
            column-gap: clamp(12px, 2vw, 24px);
        }

        .nav-toolbar .lang-dropdown {
            display: inline-flex;
            align-items: center;
            padding: 8px 14px;
            border-radius: 6px;
            background: rgba(0, 240, 255, 0.1);
            border: 1px solid rgba(0, 240, 255, 0.28);
            color: rgba(255, 255, 255, 0.9);
            font-weight: 600;
            letter-spacing: 0.04em;
            white-space: nowrap;
            flex-shrink: 0;
            transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
        }

        .nav-toolbar .lang-dropdown:hover {
            background: rgba(0, 240, 255, 0.16);
            border-color: rgba(0, 240, 255, 0.45);
            box-shadow: 0 0 18px rgba(0, 240, 255, 0.18);
        }

        .lang-flag {
            margin-right: 0.35em;
        }

        .nav-masthead {
            grid-column: 1;
            grid-row: 1;
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
            align-items: center;
            column-gap: clamp(1rem, 2.5vw, 2.75rem);
            width: 100%;
            max-width: 100%;
            min-width: 0;
            min-height: 48px;
            justify-self: center;
        }

        .masthead-nav {
            display: contents;
        }

        .logo--masthead {
            position: relative;
            z-index: 2;
            grid-column: 2;
            grid-row: 1;
            justify-self: center;
            font-size: clamp(1.25rem, 2vw, 1.85rem);
            letter-spacing: 0.12em;
            padding: 0 clamp(1rem, 3vw, 2rem);
            text-align: center;
            flex-shrink: 0;
        }

        .nav-toolbar {
            grid-column: 2;
            grid-row: 1;
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 16px;
            justify-self: end;
            flex-shrink: 0;
            min-width: max-content;
        }

        .logo {
            font-family: var(--font-tech);
            font-weight: 900;
            color: #fff;
            text-transform: uppercase;
            text-shadow: 0 0 10px var(--neon-blue);
        }

        .logo--masthead::before,
        .logo--masthead::after {
            content: '';
            position: absolute;
            top: 50%;
            width: 1px;
            height: 2rem;
            background: linear-gradient(to bottom, transparent, rgba(0, 240, 255, 0.45), transparent);
            transform: translateY(-50%);
            pointer-events: none;
        }

        .logo--masthead::before { left: 0.25rem; }
        .logo--masthead::after { right: 0.25rem; }

        .logo span {
            color: var(--neon-blue);
        }

        .masthead-nav__side {
            display: flex;
            align-items: center;
            gap: clamp(1rem, 2vw, 2rem);
        }

        .masthead-nav__side--start {
            grid-column: 1;
            grid-row: 1;
            justify-self: end;
        }

        .masthead-nav__side--end {
            grid-column: 3;
            grid-row: 1;
            justify-self: start;
        }

        .masthead-nav__link {
            display: inline-flex;
            align-items: center;
            padding: 8px 4px 10px;
            position: relative;
            white-space: nowrap;
            font-size: 15px;
            font-weight: 600;
            letter-spacing: 0.14em;
            color: rgba(255, 255, 255, 0.78);
            transition: color 0.3s ease, text-shadow 0.3s ease;
        }

        .masthead-nav__link::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 0;
            height: 1px;
            background: linear-gradient(90deg, transparent, var(--neon-blue), transparent);
            box-shadow: 0 0 10px rgba(0, 240, 255, 0.55);
            transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
        }

        .masthead-nav__link:hover,
        .masthead-nav__link.nav-active {
            color: #fff;
        }

        .masthead-nav__link.nav-active {
            text-shadow: 0 0 18px rgba(0, 240, 255, 0.35);
        }

        .masthead-nav__link:hover::after,
        .masthead-nav__link.nav-active::after {
            width: 100%;
        }

        .nav-actions {
            display: flex;
            align-items: center;
            gap: 16px;
            flex-shrink: 0;
        }

        /* Language dropdown — click to open (see ui.initLangDropdown) */
        .lang-dropdown {
            position: relative;
            cursor: pointer;
            font-size: 14px;
            user-select: none;
        }
        .nav-toolbar .lang-menu {
            left: auto;
            right: 0;
        }

        .lang-menu {
            display: none;
            position: absolute;
            top: calc(100% + 8px);
            right: 0;
            background: var(--bg-panel);
            backdrop-filter: blur(10px);
            border: 1px solid var(--border-glow);
            border-radius: 8px;
            padding: 8px 0;
            min-width: 120px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.5);
            z-index: 1100;
        }
        .lang-menu.active {
            display: block;
        }
        .lang-menu li {
            padding: 8px 16px;
            transition: background 0.2s;
        }
        .lang-menu li:hover {
            background: rgba(0, 240, 255, 0.1);
            color: var(--neon-blue);
        }

        /* Button styles */
        .btn {
            display: inline-block;
            padding: 10px 24px;
            font-family: var(--font-tech);
            font-size: 14px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 1px;
            border-radius: 4px;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }

        .btn-outline {
            background: transparent;
            color: var(--neon-blue);
            border: 1px solid var(--neon-blue);
            box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
        }
        .btn-outline:hover {
            background: rgba(0, 240, 255, 0.1);
            box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
        }

        .btn-primary {
            background: var(--neon-blue);
            color: var(--bg-dark);
            border: 1px solid var(--neon-blue);
            box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
        }
        .btn-primary:hover {
            background: transparent;
            color: var(--neon-blue);
            box-shadow: 0 0 25px rgba(0, 240, 255, 0.8), inset 0 0 10px rgba(0, 240, 255, 0.5);
        }

        .mobile-menu-btn {
            display: none;
            background: none;
            border: none;
            color: white;
            font-size: 24px;
            cursor: pointer;
            flex-shrink: 0;
        }

        .hidden { display: none !important; }

        .nav-auth-group {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        #user-menu {
            display: flex;
            align-items: center;
            gap: 12px;
            flex-shrink: 0;
        }

        #user-menu-btn {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            white-space: nowrap;
        }

        .nav-user-avatar {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 1.65rem;
            height: 1.65rem;
            border-radius: 50%;
            background: rgba(5, 9, 20, 0.35);
            font-size: 0.72rem;
            font-weight: 700;
            line-height: 1;
            flex-shrink: 0;
        }

        @media (max-width: 1280px) {
            .nav-masthead {
                column-gap: clamp(0.75rem, 2vw, 1.5rem);
            }

            .masthead-nav__side {
                gap: clamp(0.65rem, 1.5vw, 1.25rem);
            }

            #user-menu {
                gap: 8px;
            }

            #user-menu-btn,
            #nav-logout-btn {
                padding: 8px 14px;
                font-size: 12px;
                letter-spacing: 0.04em;
            }
        }

        @media (max-width: 1200px) {
            .nav-masthead {
                column-gap: clamp(1rem, 2.5vw, 2rem);
            }

            .masthead-nav__link {
                font-size: 14px;
                letter-spacing: 0.1em;
            }

            .nav-auth-group .btn {
                padding: 8px 16px;
                font-size: 13px;
            }
        }

        @media (max-width: 1100px) {
            .nav-container {
                column-gap: 12px;
            }

            .masthead-nav__side {
                gap: 0.75rem;
            }

            .masthead-nav__link {
                padding: 6px 2px 8px;
            }
        }

        @media (max-width: 992px) {
            #main-nav .container {
                padding: 0 12px;
                max-width: 100%;
                overflow: visible;
            }

            .nav-container {
                display: flex;
                align-items: center;
                gap: 8px;
                width: 100%;
                min-width: 0;
            }

            .nav-masthead {
                order: 1;
                flex: 0 1 auto;
                display: block;
                grid-template-columns: none;
                justify-self: auto;
                width: auto;
                max-width: 45%;
                min-width: 0;
                min-height: 0;
            }

            .nav-toolbar {
                order: 2;
                flex: 0 0 auto;
                margin-left: auto;
                min-width: 0;
                gap: 8px;
            }

            .nav-toolbar .lang-dropdown {
                padding: 6px 8px;
                font-size: 12px;
                max-width: 100%;
            }

            .masthead-nav {
                display: none;
            }

            .logo--masthead {
                display: inline-block;
                grid-column: auto;
                justify-self: auto;
                padding: 0;
                font-size: 1.15rem;
                letter-spacing: 0.06em;
                max-width: 100%;
            }

            .logo--masthead::before,
            .logo--masthead::after {
                display: none;
            }

            .mobile-menu-btn {
                display: block;
                padding: 4px;
                line-height: 1;
            }

            /* Keep auth / workspace controls out of the top bar; they live in the drawer */
            .nav-toolbar > .nav-actions {
                display: none;
            }

            .masthead-nav.mobile-active {
                display: flex;
                flex-direction: column;
                align-items: stretch;
                position: absolute;
                top: var(--header-height);
                left: 0;
                width: 100%;
                padding: 20px 24px 24px;
                background: rgba(5, 9, 20, 0.97);
                border-bottom: 1px solid var(--border-glow);
                gap: 0;
                z-index: 999;
            }

            .masthead-nav.mobile-active .masthead-nav__side {
                flex-direction: column;
                align-items: stretch;
                gap: 0;
            }

            .masthead-nav.mobile-active .masthead-nav__side--start,
            .masthead-nav.mobile-active .masthead-nav__side--end {
                grid-column: auto;
                grid-row: auto;
                justify-self: stretch;
            }

            .masthead-nav.mobile-active .masthead-nav__link {
                align-items: flex-start;
                min-width: 0;
                padding: 14px 4px;
                font-size: 16px;
                letter-spacing: 0.08em;
                border-bottom: 1px solid rgba(255, 255, 255, 0.06);
            }

            .masthead-nav.mobile-active .nav-actions {
                display: flex;
                flex-direction: column;
                width: 100%;
                margin-top: 16px;
                padding-top: 16px;
                border-top: 1px solid rgba(255, 255, 255, 0.08);
                gap: 10px;
            }

            .masthead-nav.mobile-active .nav-actions .btn {
                display: inline-flex;
                width: 100%;
                justify-content: center;
            }

            .masthead-nav.mobile-active .nav-actions #user-menu,
            .masthead-nav.mobile-active .nav-actions #auth-buttons {
                display: flex;
                flex-direction: column;
                width: 100%;
                gap: 10px;
            }
        }

        /* Site footer */
        .page-foot {
            margin-top: auto;
            border-top: 1px solid rgba(0, 240, 255, 0.12);
            background: linear-gradient(180deg, rgba(5, 9, 20, 0.4) 0%, #020508 100%);
            color: var(--text-muted);
        }

        .page-foot__upper {
            display: flex;
            align-items: flex-end;
            justify-content: space-between;
            gap: 32px 48px;
            padding: 48px 24px 36px;
            flex-wrap: wrap;
        }

        .page-foot__brand {
            flex: 1 1 18rem;
            max-width: 36rem;
        }

        .page-foot__logo {
            font-family: var(--font-tech);
            font-size: 1.35rem;
            font-weight: 900;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: #fff;
            text-shadow: 0 0 12px rgba(0, 240, 255, 0.35);
        }

        .page-foot__logo span {
            color: var(--neon-blue);
        }

        .page-foot__intro {
            margin-top: 12px;
            font-size: 0.875rem;
            line-height: 1.75;
            color: rgba(148, 163, 184, 0.88);
        }

        .page-foot__nav-stack {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            gap: 14px;
            flex: 1 1 16rem;
        }

        .page-foot__nodes,
        .page-foot__rail {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            justify-content: flex-end;
            gap: 8px 28px;
            width: 100%;
        }

        .page-foot__nodes-label {
            flex-shrink: 0;
            margin-right: 4px;
            font-size: 0.875rem;
            font-weight: 500;
            letter-spacing: 0.04em;
            color: rgba(226, 232, 240, 0.72);
        }

        .page-foot__nodes a {
            font-family: var(--font-tech);
            font-size: 0.8125rem;
            font-weight: 600;
            letter-spacing: 0.08em;
            color: rgba(0, 240, 255, 0.72);
            transition: color 0.25s ease;
        }

        .page-foot__nodes a:hover {
            color: var(--neon-blue);
        }

        .page-foot__rail a {
            font-family: var(--font-tech);
            font-size: 0.8125rem;
            font-weight: 600;
            letter-spacing: 0.08em;
            color: rgba(0, 240, 255, 0.72);
            transition: color 0.25s ease;
        }

        .page-foot__rail a:hover {
            color: var(--neon-blue);
        }

        .page-foot__divider {
            height: 1px;
            background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.22), transparent);
        }

        .page-foot__lower {
            display: grid;
            grid-template-columns: 1fr auto 1fr;
            align-items: center;
            gap: 16px 24px;
            padding: 22px 24px 28px;
        }

        .page-foot__legal {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 20px;
            justify-self: start;
        }

        .page-foot__legal a {
            font-size: 0.8125rem;
            color: rgba(148, 163, 184, 0.9);
            transition: color 0.25s ease;
        }

        .page-foot__legal a:hover {
            color: var(--neon-blue);
        }

        .page-foot__email {
            justify-self: center;
            font-family: var(--font-code);
            font-size: 0.8125rem;
            letter-spacing: 0.04em;
            color: rgba(226, 232, 240, 0.78);
            transition: color 0.25s ease;
        }

        .page-foot__email:hover {
            color: var(--neon-blue);
        }

        .page-foot__copy {
            justify-self: end;
            font-size: 0.8125rem;
            color: rgba(148, 163, 184, 0.75);
            text-align: right;
        }

        .page-foot__disclaimer {
            padding: 0 24px 32px;
            font-size: 0.75rem;
            line-height: 1.6;
            color: rgba(148, 163, 184, 0.45);
            text-align: center;
        }

        @media (max-width: 768px) {
            .page-foot__upper {
                flex-direction: column;
                align-items: flex-start;
                gap: 24px;
                padding: 36px 24px 28px;
            }

            .page-foot__brand {
                flex: 0 0 auto;
                max-width: none;
            }

            .page-foot__nav-stack {
                flex: 0 0 auto;
                align-items: flex-start;
                width: 100%;
                gap: 12px;
            }

            .page-foot__nodes,
            .page-foot__rail {
                justify-content: flex-start;
                gap: 10px 20px;
            }

            .page-foot__lower {
                grid-template-columns: 1fr;
                text-align: center;
                padding-bottom: 20px;
            }

            .page-foot__legal,
            .page-foot__email,
            .page-foot__copy {
                justify-self: center;
                text-align: center;
            }

            .page-foot__legal {
                justify-content: center;
            }
        }
