/* Critical CSS - Above the fold styles only */
:root {
    /* Colors */
    --bg: #ffffff;
    --text: #171717;
    --text-muted: #737373;
    --text-accent: #0969da;
    --border: #e5e5e5;
    /* Typography */
    --font-sans: 'Inter var', 'Inter', system-ui, sans-serif;
    /* Layout */
    --nav-height: 60px;
}

[data-theme="dark"] {
    --bg: #0a0a0a;
    --text: #f5f5f5;
    --text-accent: #58a6ff;
    --border: #262626;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    transition: background 0.2s, color 0.2s;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

/* Navigation - Critical for above the fold */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    transition: background 0.2s;
}

[data-theme="dark"] .nav {
    background: rgba(10, 10, 10, 0.8);
}

.nav-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    position: relative;
}

.nav-link:hover {
    color: var(--text);
    background: rgba(0, 0, 0, 0.05);
}

.nav-link.active {
    color: var(--text-accent);
    background: rgba(9, 105, 218, 0.1);
}

.nav-controls {
    position: absolute;
    right: 0;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.theme-toggle,
.mobile-menu-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: color 0.2s;
}

.theme-toggle:hover,
.mobile-menu-toggle:hover {
    color: var(--text);
}

.mobile-menu-toggle {
    display: none;
}

/* Main Content */
.main {
    margin-top: var(--nav-height);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1.5rem;
}

/* Hero Section - Above the fold */
.hero {
    padding: 4rem 0;
    text-align: center;
}

.hero-profile-image {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.profile-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.profile-img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-color: var(--text-accent);
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
}

.hero-intro {
    font-size: 1.125rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.7;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hero-intro.content-loaded {
    opacity: 1;
}

.hero-intro a {
    color: var(--text-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    flex-wrap: wrap;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hero-actions.content-loaded {
    opacity: 1;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 0.925rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    cursor: pointer;
}

.btn-primary {
    background: var(--text-accent);
    color: var(--bg);
    border-color: var(--text-accent);
}

.btn-primary:hover {
    background: transparent;
    color: var(--text-accent);
    border-color: var(--text-accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Loading state */
.loading {
    display: flex;
    justify-content: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* Mobile optimizations for critical content */
@media (max-width: 768px) {
    .nav-container {
        justify-content: space-between;
        padding: 0 1rem;
    }

    .nav-links {
        display: none;
    }

    .mobile-menu-toggle {
        display: block !important;
    }

    .main {
        padding: 0 1rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .profile-img {
        width: 100px;
        height: 100px;
    }
}

/* Minimal social links styling for critical loading */
.social-links {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 2rem 0;
    min-height: 44px; /* Prevent layout shift */
    align-items: center;
}

/* Hide social links initially to prevent flash */
.social-links:empty {
    background: transparent;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--border);
    border-radius: 50%;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
    opacity: 0;
    animation: fadeInSocial 0.3s ease 0.1s forwards;
}

.social-link:hover {
    background: var(--text-accent);
    color: white;
    transform: translateY(-2px);
}

/* Fade in animation for social links */
@keyframes fadeInSocial {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Social loading skeleton */
.social-loading {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 0;
}

.social-skeleton {
    width: 44px;
    height: 44px;
    background: var(--border);
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.social-skeleton::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: skeleton-shimmer 2s infinite;
}

[data-theme="dark"] .social-skeleton::before {
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
}

/* Hide loading skeleton when JavaScript loads social links */
.social-links:not(:empty) .social-loading {
    display: none;
}

/* JavaScript-only elements are hidden when JS is disabled */
.js-only {
    display: block;
}

@keyframes skeleton-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

@keyframes skeleton-shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}