/* ==========================================================================
   CSS Custom Properties - Theme Variables
   ========================================================================== */
:root {
    /* Colors - Dark theme palette */
    --color-bg-primary: #000000;
    --color-bg-secondary: #111111;
    --color-text-primary: #ffffff;
    --color-text-secondary: #cccccc;
    --color-accent: #ffffff;
    --color-hover: #555555;
    --color-border: #333333;
    
    /* Typography - Scalable font system */
    --font-family-primary: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-size-base: 16px;
    --font-size-lg: 1.25rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-bold: 700;
    --line-height-base: 1.6;
    --line-height-tight: 1.2;
    
    /* Spacing - Consistent rhythm */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Layout - Responsive breakpoints */
    --sidebar-width: 20%;
    --main-width: 80%;
    --border-radius: 8px;
    --transition-speed: 0.3s;
}

/* ==========================================================================
   Base Styles - Mobile-first approach
   ========================================================================== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: var(--spacing-sm);
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    /* Mobile-first: Stack vertically on small screens */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ==========================================================================
   Sidebar Navigation - Mobile-first responsive design
   ========================================================================== */
.sidebar {
    /* Mobile-first: Full width header on small screens */
    width: 100%;
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--color-bg-secondary);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-md);
}

.portrait {
    /* Mobile-first: Smaller portrait on mobile */
    width: 120px;
    height: 120px;
    padding: 0;
    margin-bottom: var(--spacing-sm);
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--color-border);
    transition: transform var(--transition-speed) ease;
    background-color: var(--color-bg-secondary);
}

.portrait:hover {
    transform: scale(1.05);
}

.profile-name {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    margin: var(--spacing-sm) 0;
    text-align: center;
    line-height: var(--line-height-tight);
}

.nav-line {
    width: 100%;
    height: 2px;
    background-color: var(--color-border);
    margin: var(--spacing-sm) 0;
    border-radius: 1px;
}

/* ==========================================================================
   Navigation Elements - Responsive and accessible
   ========================================================================== */
nav {
    display: flex;
    flex-direction: row;
    gap: var(--spacing-xs);
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

.nav-element {
    text-decoration: none;
    color: var(--color-text-primary);
    background-color: transparent;
    display: flex;
    font-family: var(--font-family-primary);
    font-weight: var(--font-weight-medium);
    font-size: 0.9rem;
    padding: var(--spacing-xs) var(--spacing-sm);
    text-align: center;
    border-radius: 20px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    /* Better touch targets for mobile */
    min-height: 36px;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.nav-element::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.nav-element:hover::before {
    left: 100%;
}

.nav-element:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.1);
}

.nav-element.active {
    color: var(--color-bg-primary);
    background: linear-gradient(135deg, #ffffff, #f0f0f0);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 10px rgba(255, 255, 255, 0.2);
}

.nav-element:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* ==========================================================================
   Main Content Area - Responsive and readable
   ========================================================================== */
main {
    /* Mobile-first: Full width on small screens */
    width: 100%;
    padding: var(--spacing-md);
    flex: 1;
    background-color: var(--color-bg-secondary);
    border-radius: var(--border-radius);
    /* Improved readability with max-width */
    max-width: 100%;
    /* Smooth transition for SPA navigation */
    transition: opacity 0.2s ease-in-out;
}

/* ==========================================================================
   Typography - Improved hierarchy and readability
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-primary);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    margin-top: 0;
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-primary);
}

h1 {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--spacing-md);
}

h2 {
    font-size: var(--font-size-xl);
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
}

h3 {
    font-size: var(--font-size-lg);
}

p {
    margin-bottom: var(--spacing-md);
    color: var(--color-text-secondary);
    max-width: 65ch; /* Optimal reading width */
}

ul, ol {
    margin-bottom: var(--spacing-md);
    padding-left: var(--spacing-md);
}

li {
    margin-bottom: var(--spacing-xs);
    color: var(--color-text-secondary);
}

/* ==========================================================================
   Responsive Design - Desktop breakpoint
   ========================================================================== */
@media (min-width: 768px) {
    body {
        flex-direction: row;
        padding: var(--spacing-lg);
        gap: var(--spacing-lg);
    }
    
    .sidebar {
        width: 280px;
        margin-bottom: 0;
        position: sticky;
        top: var(--spacing-lg);
        height: fit-content;
    }
    
    .portrait {
        width: 160px;
        height: 160px;
        margin-bottom: var(--spacing-md);
    }
    
    nav {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .nav-element {
        width: 100%;
        justify-content: center;
    }
    
    main {
        width: var(--main-width);
        flex: 1;
    }
}

/* ==========================================================================
   Accessibility and Performance
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for better keyboard navigation */
:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Debug border - uncomment to visualize layout */
/* * { border: 1px solid rgba(255, 255, 255, 0.1); } */
