/* Mirkoverse brand fonts, self-hosted (variable woff2, latin subset). */
@font-face { font-family: 'Space Grotesk'; src: url('../fonts/space-grotesk-latin.woff2') format('woff2'); font-weight: 300 700; font-display: swap; }
@font-face { font-family: 'Orbitron'; src: url('../fonts/orbitron-latin.woff2') format('woff2'); font-weight: 400 900; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('../fonts/jetbrains-mono-latin.woff2') format('woff2'); font-weight: 100 800; font-display: swap; }

:root {
    /* Light mode: Bianco background, Space Black text */
    --nm-bg: #F5F6FA;
    --nm-card: #ffffff;
    --nm-text: #08070F;
    --nm-border: rgba(121, 124, 148, 0.2);
    --glass-bg: rgba(255, 255, 255, 0.78);
    --glass-border: rgba(107, 127, 212, 0.18);
    --glass-shadow: 0 8px 32px 0 rgba(8, 7, 15, 0.08);
    --glass-text: #16142A;
    color-scheme: light;
}

/* Dark mode: Space Black, the brand's primary background */
html.dark {
    --nm-bg: #08070F;
    --nm-card: #16142A;
    --nm-text: #F5F6FA;
    --nm-border: rgba(168, 180, 232, 0.12);
    --glass-bg: rgba(22, 20, 42, 0.72);
    --glass-border: rgba(168, 180, 232, 0.12);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --glass-text: #F5F6FA;
    color-scheme: dark;
}

html {
    -webkit-tap-highlight-color: rgba(107, 127, 212, 0.25);
    touch-action: manipulation;
}

body {
    background-color: var(--nm-bg);
    color: var(--nm-text);
    transition: background-color 0.3s ease, color 0.3s ease;
    font-family: 'Space Grotesk', system-ui, sans-serif;
    /* Faint Indigo / Lunar Blue glow, like the site's expanding universe */
    background-image:
        radial-gradient(at 0% 0%, rgba(107, 127, 212, 0.14) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(168, 180, 232, 0.10) 0px, transparent 50%);
    background-attachment: fixed;
}

/* Display font: wordmark and page titles */
h1, nav .bg-clip-text {
    font-family: 'Orbitron', 'Space Grotesk', sans-serif;
    letter-spacing: 0.02em;
}

/* Amounts line up in columns */
.font-mono, .tabular-nums { font-variant-numeric: tabular-nums; }

/*.dark body needs no extra gradient or maybe subtle logic? standard inherits.*/

/* Navbar responsiveness helper */
.navbar-responsive {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.5rem;
}

@media (max-width: 640px) {
    .navbar-responsive span.text-xs {
        display: none !important;
    }

    main {
        padding-top: 1rem !important;
        padding-bottom: 5rem !important;
        /* Space for bottom nav */
    }

    .glass-card {
        padding: 1.25rem !important;
    }

    h2 {
        font-size: 1.5rem !important;
    }
}

/* Bottom Navigation Bar */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 100;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--glass-text);
    opacity: 0.6;
    transition: opacity 0.2s, color 0.2s, transform 0.2s;
    font-size: 0.7rem;
    font-weight: 500;
}

.bottom-nav-item.active {
    opacity: 1;
    color: #6B7FD4; /* Indigo */
}

html.dark .bottom-nav-item.active {
    color: #A8B4E8; /* Lunar Blue */
}

.bottom-nav-item:active {
    transform: scale(0.9);
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    /* Increased blur */
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.2);
    border-color: rgba(99, 102, 241, 0.5);
    /* Indigo hint on hover */
}

html.dark .glass-card:hover {
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.6);
    border-color: rgba(167, 139, 250, 0.5);
    /* Purple hint */
}

/* Helper for gradient text */
.gradient-text {
    background: linear-gradient(135deg, #6B7FD4 0%, #A8B4E8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

html.dark .gradient-text {
    background: linear-gradient(135deg, #8A9ADE 0%, #C3CCF0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Input fields in glass cards */
.glass-input {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4px);
    transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

/* Focus state for inputs */
.glass-input:focus {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 2px rgba(107, 127, 212, 0.5);
}

html.dark .glass-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
}

html.dark .glass-input:focus {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(96, 165, 250, 0.5);
    box-shadow: 0 0 0 2px rgba(107, 127, 212, 0.3);
}

.icon-bg {
    background: rgba(107, 127, 212, 0.1);
    border: 1px solid rgba(107, 127, 212, 0.2);
}

html.dark .icon-bg {
    background: rgba(107, 127, 212, 0.2);
    border: 1px solid rgba(107, 127, 212, 0.3);
}

.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.5);
    border-radius: 20px;
}

/* Alpine.js hides [x-cloak] elements until it has initialized; without this
   rule x-cloak does nothing and elements flash visible before Alpine hides them. */
[x-cloak] {
    display: none !important;
}

/* Respect the OS-level reduced motion preference. Loading spinners are kept
   spinning since they convey essential state, not decoration. */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .animate-spin {
        animation-duration: 1s !important;
        animation-iteration-count: infinite !important;
    }
}

/* Bottom sheets and dialogs: scrolling inside must not scroll the page under. */
[role="dialog"], .sheet {
    overscroll-behavior: contain;
}
