:root {
    --primary: #1a5585;
    --primary-light: #9ccef4;
    --text: #1f2937;
    --text-secondary: #374151;
    --background: #ffffff;
    --surface: #f8fafc;
    --title: #f8fafc;
    --surface-alt: #f1f5f9;
    --border: #cbd5e1;
    --link: #1a5585;
    --link-hover: #0f3555;
    --header-link-hover: #ffffff;
    
    --gradient-primary: linear-gradient(135deg, #1a5585 0%, #2563eb 100%);
    --gradient-surface: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.05);
    --radius: 16px;
    --radius-sm: 8px;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --primary: #9ccef4;
        --primary-light: #1a5585;
        --text: #f8fafc;
        --text-secondary: #e2e8f0;
        --background: #0f172a;
        --surface: #1e293b;
        --title: #f8fafc;
        --surface-alt: #334155;
        --border: #475569;
        --link: #9ccef4;
        --link-hover: #cce5f7;
        --header-link-hover: #ffffff;
        
        --gradient-primary: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
        --gradient-surface: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    }
}

:root[data-theme="dark"] {
    --primary: #9ccef4;
    --primary-light: #1a5585;
    --text: #f8fafc;
    --text-secondary: #e2e8f0;
    --background: #0f172a;
    --surface: #1e293b;
    --title: #f8fafc;
    --surface-alt: #334155;
    --border: #475569;
    --link: #9ccef4;
    --link-hover: #cce5f7;
    --header-link-hover: #ffffff;
    
    --gradient-primary: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --gradient-surface: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--background);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.header {
    position: relative;
    padding: 4rem 2rem;
    background: var(--gradient-primary);
    clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%);
    margin-bottom: 6rem;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 3rem;
    align-items: center;
}

.avatar-container {
    position: relative;
}

.avatar {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 4px solid var(--primary-light);
    background: var(--surface);
    padding: 4px;
}

.title {
    color: var(--title);
}

.title h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    line-height: 1.2;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.title p {
    font-size: 1.5rem;
    opacity: 0.9;
}

.contact-info {
    margin-top: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.4;
}

.contact-info p {
    margin: 0.3rem 0;
    font-size: 0.95rem;
}

.contact-info a {
    color: var(--title);
    opacity: 0.9;
    text-decoration: none;
}

.contact-info a:hover {
    color: var(--header-link-hover);
    opacity: 1;
    text-decoration: underline;
}

.section {
    margin-bottom: 4rem;
}

.section h2 {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 2rem;
    position: relative;
    display: inline-block;
}

.section h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.intro {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 800px;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.skill-card {
    background: var(--gradient-surface);
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.skill-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px var(--shadow);
}

.certifications {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.certification {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.certification:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px var(--shadow);
}

.cert-image {
    width: 100%;
    height: 200px;
    object-fit: contain;
    background: var(--surface-alt);
    padding: 2rem;
}

.cert-content {
    padding: 1.5rem;
}

.contact-section {
    background: var(--gradient-surface);
    border-radius: var(--radius);
    padding: 2rem;
    border: 1px solid var(--border);
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-top: 1.5rem;
}

/* CV-specific styles for flowing layout */
.skills-content {
    columns: 2;
    column-gap: 3rem;
    column-fill: balance;
    margin-top: 1.5rem;
}

@media (max-width: 768px) {
    .skills-content {
        columns: 1;
    }
}

.skill-group {
    break-inside: avoid;
    margin-bottom: 2rem;
    display: inline-block;
    width: 100%;
}

.skill-group h3 {
    color: var(--primary);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.skill-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.skill-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.skill-list li:last-child {
    border-bottom: none;
}

.work-history {
    max-width: none;
}

.work-entry {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border);
}

.work-entry:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.work-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.work-header h3 {
    color: var(--primary);
    font-size: 1.3rem;
    margin: 0;
}

.work-period {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.95rem;
}

.work-title {
    color: var(--text);
    font-size: 1.1rem;
    margin: 0 0 1rem 0;
    font-weight: 600;
}

.work-description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

a {
    color: var(--link);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

.theme-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text);
    box-shadow: 0 2px 8px var(--shadow);
    transition: transform 0.2s ease;
}

.theme-toggle:hover {
    transform: rotate(180deg);
}

@media (max-width: 768px) {
    .header {
        padding: 2rem 1rem;
        clip-path: polygon(0 0, 100% 0, 100% 92%, 0 100%);
        margin-bottom: 3rem;
    }

    .header-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 1.5rem;
    }

    .avatar-container {
        justify-self: center;
    }

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

    .title p {
        font-size: 1.25rem;
    }

    .container {
        padding: 0 1rem;
    }

    .section h2 {
        font-size: 1.75rem;
    }

    .intro {
        font-size: 1.1rem;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }
}