/* 
   AISYSTEMS Design System 
   Theme: Rational Minimalist / Infrastructure Dark 
*/

:root {
    /* Colors */
    --bg-app: #0f0f11;
    --bg-sidebar: #161618;
    --bg-content: #0f0f11;

    --text-primary: #e6e6e6;
    --text-secondary: #999999;
    --text-muted: #555555;

    --accent-color: #a1d5ffb4;
    /* Cyan/Teal for "System Active" feel */
    --accent-dim: rgba(33, 101, 190, 0.808);

    --border-color: #2a2a2d;
    --border-light: #333336;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
    /* App-like feel */
}

body.no-scroll {
    overflow: hidden;
    /* Lock scroll when mobile menu is open */
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    z-index: 100;
}

.logo-area {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s ease;
}

.mobile-menu-btn {
    display: none;
    /* Hidden on desktop */
}

.logo-area:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.sidebar-logo {
    width: 130px;
    /* Reduced by ~10% from 144px */
    height: auto;
    filter: grayscale(100%) brightness(0.8);
    transition: filter 0.3s ease;
}

.logo-area:hover .sidebar-logo {
    filter: grayscale(0%) brightness(1);
    /* Reveal color on hover if logo has color, or bright white */
    /* If logo is monochrome SVG, maybe use filter: drop-shadow(0 0 5px var(--accent-color)); */
}

.nav-scroll {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-sm) 0;
}

.nav-list {
    list-style: none;
}

.nav-item {
    padding: 0.5rem var(--spacing-md);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
}

.nav-item:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
    color: var(--text-primary);
    border-left-color: var(--accent-color);
    color: var(--text-primary);
    border-left-color: var(--accent-color);
    background-color: var(--accent-dim);
    font-weight: 500;
}

a.nav-item {
    display: block;
    text-decoration: none;
}

.sidebar-footer {
    padding: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

/* Content Area */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

#neural-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    /* Ensure it doesn't block clicks */
}

/* Main Header */
.main-header {
    position: relative;
    z-index: 1;
    padding: var(--spacing-lg) var(--spacing-lg) 0 var(--spacing-lg);
    margin-left: 15%;
    /* Align with content container text offset */
    max-width: 1200px;
}

.brand-title {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.brand-tagline {
    font-family: var(--font-sans);
    font-size: 1.5rem;
    /* Larger impact */
    font-weight: 300;
    color: var(--text-primary);
    line-height: 1.3;
    max-width: 800px;
}

#content-container {
    position: relative;
    z-index: 1;
    flex: 1;
    overflow-y: auto;
    /* Keep 15% left padding for alignment, but 0 right padding for scrollbar */
    padding: var(--spacing-md) 0 var(--spacing-lg) 15%;
    /* Remove max-width so scrollbar hits the edge */
    max-width: none;
    scroll-behavior: smooth;
    display: flex;
    /* Enable flex for centering child */
    flex-direction: column;
}

.content-wrapper {
    margin-top: 0;
    margin-bottom: var(--spacing-lg);
    width: 100%;
    /* Re-apply max-width here to keep text from being too wide */
    max-width: 1200px;
    padding-right: var(--spacing-lg);
    /* Add padding here so text doesn't touch scrollbar on small screens */
}

/* Markdown Styling */
.markdown-body h1 {
    font-size: 1.8rem;
    /* Was 2.2rem */
    font-weight: 600;
    letter-spacing: -0.03em;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

.markdown-body h2 {
    font-size: 1.25rem;
    /* Was 1.5rem */
    font-weight: 500;
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.markdown-body h3 {
    font-size: 1rem;
    /* Was 1.2rem */
    font-weight: 500;
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-xs);
}

.markdown-body p {
    font-size: 0.9rem;
    /* Standardizing smaller body text */
    margin-bottom: var(--spacing-sm);
    color: var(--text-secondary);
    max-width: 75ch;
    /* Slightly wider since font is smaller */
}

.markdown-body ul,
.markdown-body ol {
    font-size: 0.9rem;
    margin-bottom: var(--spacing-sm);
    padding-left: 1.5rem;
    color: var(--text-secondary);
    max-width: 75ch;
}

.markdown-body p strong {
    color: var(--text-primary);
    font-weight: 600;
}

.markdown-body li {
    margin-bottom: 0.25rem;
}

.markdown-body code {
    font-family: var(--font-mono);
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 0.85em;
    color: #888;
}

.markdown-body pre {
    background: #000;
    padding: var(--spacing-sm);
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: var(--spacing-sm);
    border: 1px solid var(--border-color);
}

.markdown-body strong {
    color: #fff;
    font-weight: 600;
}

.markdown-body blockquote {
    border-left: 3px solid var(--accent-color);
    padding-left: var(--spacing-sm);
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: var(--spacing-sm);
}

.markdown-body a {
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-color: var(--text-muted);
    transition: all 0.2s ease;
}

.markdown-body a:hover {
    color: #fff;
    text-decoration-color: var(--accent-color);
}

/* Footer */
.content-footer {
    position: relative;
    z-index: 1;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    background-color: var(--bg-content);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-slogan {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.8;
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}



/* Language Switcher */
.lang-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.lang-opt {
    transition: color 0.2s;
}

.lang-opt:hover {
    color: var(--text-primary);
}

.lang-opt.active {
    color: var(--accent-color);
    font-weight: 600;
}

a.lang-opt {
    text-decoration: none;
    color: var(--text-muted);
    /* Force gray color for links */
}

.divider {
    color: var(--border-light);
}

/* Loading State */
.loading-state {
    font-family: var(--font-mono);
    color: var(--text-muted);
    padding: var(--spacing-lg);
    text-align: center;
    animation: pulse 2s infinite;
}

/* Welcome Screen */
.welcome-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 60vh;
    /* Center vertically in the visible area */
    text-align: center;
    color: var(--text-primary);
}

.welcome-line {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 0.8s ease-out forwards;
}

.w-line-1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: var(--spacing-sm);
    animation-delay: 0.5s;
}

.w-line-2 {
    font-size: 1.2rem;
    font-weight: 300;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
    animation-delay: 1.5s;
}

.w-line-3 {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-color);
    letter-spacing: 0.05em;
    animation-delay: 2.5s;
    margin-bottom: var(--spacing-sm);
}

.w-line-4 {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    animation-delay: 3.5s;
    /* Opacity handled by animation */
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-app);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsiveness */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        height: 100vh;
        /* Ensure full height */
        overflow: hidden;
        /* Prevent body scroll when menu might be open, though simplified here */
    }

    /* Mobile Menu Button */
    .mobile-menu-btn {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 24px;
        /* Slightly smaller for cleaner look */
        height: 18px;
        background: none;
        border: none;
        cursor: pointer;
        z-index: 1201;
        /* Above sidebar overlay and logo area */
        padding: 0;
        pointer-events: auto;
        /* Ensure clickable */
    }

    .mobile-menu-btn span {
        display: block;
        width: 100%;
        height: 2px;
        background-color: var(--text-primary);
        transition: all 0.3s ease;
        border-radius: 2px;
    }

    /* Hamburger Animation when open */
    .sidebar.mobile-open .mobile-menu-btn span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .sidebar.mobile-open .mobile-menu-btn span:nth-child(2) {
        opacity: 0;
    }

    .sidebar.mobile-open .mobile-menu-btn span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    /* Mobile Sidebar State */
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        flex-shrink: 0;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        max-height: 60px;
        /* Collapsed height (Logo area only) */
        overflow: hidden;
        position: relative;
        /* Default relative */
        z-index: 1000;
        background-color: var(--bg-sidebar);
    }

    .sidebar.mobile-open {
        max-height: 100vh;
        /* Full screen expansion */
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        border-bottom: none;
        background-color: rgba(22, 22, 24, 0.98);
        /* Slight transparency */
        backdrop-filter: blur(10px);
    }

    .sidebar-logo {
        width: 100px;
    }

    .logo-area {
        height: 60px;
        /* Fixed height for navbar */
        padding: 0 var(--spacing-md);
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        border-bottom: none;
        /* Clean look */
        position: relative;
        z-index: 1200;
        /* Ensure above everything */
    }

    .nav-scroll {
        display: block;
        margin-top: 0;
        padding-top: var(--spacing-md);
        padding-bottom: var(--spacing-lg);
        height: calc(100vh - 60px);
        /* Fill remaining space */
        overflow-y: auto;
        opacity: 0;
        transform: translateY(-10px);
        transition: all 0.3s ease 0.1s;
        /* Delayed fade in */
    }

    .sidebar.mobile-open .nav-scroll {
        opacity: 1;
        transform: translateY(0);
    }

    .nav-item {
        padding: 1rem var(--spacing-md);
        /* Larger touch target */
        font-size: 1.1rem;
        /* Larger text */
        border-left: 4px solid transparent;
        /* More visible indicator */
        border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    }

    .sidebar.mobile-open .sidebar-footer {
        display: flex;
        /* Flex for centering */
        justify-content: center;
        padding-bottom: var(--spacing-lg);
        border-top: 1px solid var(--border-color);
    }

    /* Content Adjustments */
    #content-container {
        padding: var(--spacing-md);
        padding-top: var(--spacing-lg);
        /* Space from top */
        padding-left: var(--spacing-md);
        padding-right: var(--spacing-md);
    }

    .main-header {
        margin-left: 0;
        padding: var(--spacing-md);
        text-align: center;
    }

    .brand-tagline {
        font-size: 1.2rem;
        /* Smaller tagline */
        text-align: center;
    }

    /* Typography Scaling */
    .markdown-body h1 {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    .markdown-body h2 {
        font-size: 1.2rem;
        margin-top: var(--spacing-md);
    }

    .markdown-body p,
    .markdown-body ul,
    .markdown-body ol {
        font-size: 1rem;
        /* Readable body text */
        max-width: 100%;
        overflow-wrap: break-word;
        word-break: break-word;
        hyphens: auto;
    }

    /* Welcome Screen Mobile */
    .welcome-container {
        height: 50vh;
        padding: 0 var(--spacing-sm);
    }

    .w-line-1 {
        font-size: 2rem;
    }

    .w-line-2 {
        font-size: 1rem;
    }

    /* Footer Mobile */
    .content-footer {
        flex-direction: column;
        gap: var(--spacing-sm);
        text-align: center;
        padding-bottom: var(--spacing-md);
    }

    .footer-content {
        justify-content: center;
        gap: 0.5rem;
    }
}

/* Founder Signature */
.founder-signature {
    margin-top: 4rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    /* Base text slightly brighter */
}

.founder-signature a {
    color: var(--text-muted);
    /* Link darker/subtle as requested */
    text-decoration: none;
    border-bottom: 1px dotted var(--text-muted);
    transition: all 0.2s;
}

.founder-signature a:hover {
    color: var(--text-primary);
    border-bottom-color: var(--accent-color);
}