/* Design Variables (Editorial Light Theme) */
:root {
    /* Colors - Crisp Light Editorial */
    --color-bg: #fdfcfb;        /* Warm paper white */
    --color-bg-sidebar: #f8f6f2; /* Muted stone cream */
    --color-text-primary: #121315; /* Slate near-black */
    --color-text-secondary: #4a4d52; /* Charcoal grey */
    --color-text-muted: #7d8187; /* Soft grey */
    
    --color-border: #121315; /* Hairline black borders */
    --color-border-soft: #e3e0da; /* Muted dividers */
    
    --color-accent: #8c7150; /* Muted bronze/brass */
    --color-accent-light: #f5f2eb;
    
    /* Typography */
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Consolas, monospace;
    
    /* Modular Spacing */
    --space-xs: 0.5rem;   /* 8px */
    --space-sm: 1rem;     /* 16px */
    --space-md: 2rem;     /* 32px */
    --space-lg: 3.5rem;   /* 56px */
    --space-xl: 6rem;     /* 96px */
    
    --transition-clean: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Global Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    background-color: var(--color-bg);
    color: var(--color-text-primary);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body {
    position: relative;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Subtle overlay texture */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    opacity: 0.015;
    z-index: 9999;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Base Typographic Hierarchy */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 500;
    line-height: 1.15;
    color: var(--color-text-primary);
}

p {
    font-size: 1rem;
    color: var(--color-text-secondary);
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition-clean);
}

/* Layout System */
.portfolio-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Sidebar Column (Left) */
.sidebar {
    width: 35%;
    min-width: 320px;
    max-width: 440px;
    background-color: var(--color-bg-sidebar);
    border-right: 1px solid var(--color-border);
    position: relative;
}

.sidebar-inner {
    padding: var(--space-lg) var(--space-md);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* Profile Details */
.profile-header {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}

.avatar-container {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background-color: var(--color-bg);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.profile-img.loaded {
    opacity: 1;
}

.profile-avatar-fallback {
    position: absolute;
    font-family: var(--font-display);
    font-size: 2.25rem;
    color: var(--color-accent);
}

.profile-title .name {
    font-size: 2.5rem;
    letter-spacing: -0.02em;
    margin-bottom: 2px;
}

.profile-title .role {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-accent);
    font-weight: 600;
}

.bio-section .bio-text {
    font-size: 1.1rem;
    line-height: 1.45;
    color: var(--color-text-secondary);
}

/* Sidebar Blocks */
.sidebar-block {
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-sm);
}

.block-title {
    font-family: var(--font-body);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-text-muted);
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

/* Contact List */
.contact-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-list li {
    display: flex;
    flex-direction: column;
}

.contact-label {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 2px;
}

.contact-link {
    font-size: 0.9375rem;
    color: var(--color-text-primary);
    font-weight: 500;
    word-break: break-all;
    display: inline-block;
}

.contact-link:hover {
    color: var(--color-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Skills Formatting */
.skills-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.skills-category {
    display: flex;
    flex-direction: column;
}

.skills-cat-title {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-accent);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.skills-values {
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--color-text-secondary);
}

/* Mini Stats Widget */
.stats-mini-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-xs);
    background-color: var(--color-accent-light);
    padding: var(--space-sm) var(--space-xs);
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.stat-mini-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-mini-val {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--color-text-primary);
}

.stat-mini-lbl {
    font-size: 0.625rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

/* Right Content Area */
.content {
    flex-grow: 1;
    padding: var(--space-lg) var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    background-color: var(--color-bg);
}

/* Content Sections */
.content-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
}

.section-title {
    font-size: 2.25rem;
    letter-spacing: -0.02em;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 4px;
    margin-bottom: var(--space-sm);
}

/* Timeline / Item Lists */
.experience-list,
.projects-list,
.achievements-list,
.publications-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.timeline-item, 
.project-item, 
.education-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding-bottom: var(--space-md);
    border-bottom: 1px dashed var(--color-border-soft);
}

.timeline-item:last-child,
.project-item:last-child,
.education-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.item-header,
.edu-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-sm);
}

.item-title,
.edu-school {
    font-size: 1.5rem;
    font-weight: 600;
}

.item-subtitle,
.edu-degree {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-accent);
    margin-top: 2px;
}

.item-tech {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.item-date,
.edu-date {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
    text-align: right;
}

.edu-date-loc {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.edu-loc {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.item-body {
    margin-top: 4px;
}

.paragraph {
    font-size: 1rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

/* Achievements Custom Formatting */
.achievement-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: var(--space-sm);
    border-bottom: 1px dashed var(--color-border-soft);
}

.achievement-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.ach-header {
    display: flex;
    justify-content: space-between;
}

.ach-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.ach-date {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}

.ach-sub {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--color-accent);
}

/* Publications Formatting */
.pub-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pub-title {
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.3;
}

.pub-title a {
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.pub-title a:hover {
    color: var(--color-accent);
}

.pub-authors {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Footer Section */
.footer {
    background-color: var(--color-bg-sidebar);
    border-top: 1px solid var(--color-border);
    padding: var(--space-md) var(--space-lg);
    text-align: center;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

/* Navigation Button */
.projects-nav-btn {
    display: block;
    width: 100%;
    padding: 10px 14px;
    background-color: var(--color-border);
    color: var(--color-bg);
    text-align: center;
    font-weight: 600;
    font-size: 0.8125rem;
    border: 1px solid var(--color-border);
    transition: var(--transition-clean);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.projects-nav-btn:hover {
    background-color: transparent;
    color: var(--color-border);
}

/* Repos Grid & Asymmetric Card Layout */
.repos-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.repo-card {
    background-color: var(--color-bg-sidebar);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition-clean);
    position: relative;
    overflow: hidden;
}

.repo-card:hover {
    transform: translateY(-2px);
    box-shadow: 4px 4px 0px var(--color-border);
}

/* Asymmetric sizing */
.repo-card.featured {
    grid-column: span 8;
    min-height: 280px;
    border-left: 3px solid var(--color-accent);
}

.repo-card.standard {
    grid-column: span 4;
    min-height: 250px;
}

.repo-card.alternate {
    grid-column: span 6;
    min-height: 260px;
}

.repo-card.full-width {
    grid-column: span 12;
    min-height: 220px;
}

/* Card typography & details */
.repo-meta-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.repo-tag {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--color-accent);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 600;
}

.repo-lang-tag {
    background-color: var(--color-accent-light);
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
}

.repo-title-link {
    display: inline-block;
}

.repo-name {
    font-size: 1.5rem;
    font-family: var(--font-display);
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--color-text-primary);
}

.repo-name:hover {
    color: var(--color-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.repo-description {
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-md);
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.repo-card.featured .repo-description {
    -webkit-line-clamp: 4;
}

.repo-stats {
    display: flex;
    gap: var(--space-sm);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    border-top: 1px dashed var(--color-border-soft);
    padding-top: var(--space-xs);
    align-items: center;
}

.repo-stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Loading & Shimmer States */
.loading-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-lg);
    background-color: var(--color-bg-sidebar);
    border: 1px dashed var(--color-border);
    border-radius: 4px;
}

.loading-bar {
    width: 160px;
    height: 2px;
    background-color: var(--color-border-soft);
    margin: var(--space-sm) auto 0;
    border-radius: 2px;
    overflow: hidden;
}

.loading-bar-progress {
    width: 40%;
    height: 100%;
    background-color: var(--color-border);
    animation: shimmer-pulse 1.2s infinite ease-in-out;
}

@keyframes shimmer-pulse {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(250%); }
}

/* Language breakdown bar chart in sidebar */
.lang-bar-wrapper {
    display: flex;
    height: 10px;
    border-radius: 5px;
    background-color: var(--color-border-soft);
    overflow: hidden;
    gap: 1px;
}

.lang-segment {
    height: 100%;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.legend-name {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    font-weight: 500;
}

.legend-pct {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-left: auto;
}

/* Scrollbar styling */
.sidebar-inner::-webkit-scrollbar {
    width: 4px;
}
.sidebar-inner::-webkit-scrollbar-thumb {
    background: var(--color-border-soft);
    border-radius: 2px;
}

/* Responsive Rules */
@media (max-width: 860px) {
    .portfolio-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        max-width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }
    
    .sidebar-inner {
        height: auto;
        padding: var(--space-md) var(--space-sm); /* Reduced horizontal padding on mobile */
        gap: var(--space-sm);
    }
    
    .profile-title .name {
        font-size: 2rem; /* Keep header title readable and compact */
    }
    
    .content {
        padding: var(--space-md) var(--space-sm); /* Reduced horizontal padding on mobile */
        gap: var(--space-md);
    }
    
    .section-title {
        font-size: 1.85rem;
    }
    
    .item-header, .edu-header {
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        gap: 4px;
    }
    
    .item-date, .edu-date-loc {
        align-items: flex-start;
        text-align: left;
        margin-top: 2px;
    }
    
    .repo-card.featured,
    .repo-card.standard,
    .repo-card.alternate,
    .repo-card.full-width {
        grid-column: span 12;
        min-height: auto;
    }
}
