:root {
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --background: #f8fafc;
    --section-bg: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --accent: #f1f5f9;
    --accent-hover: #e2e8f0;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.7;
    margin: 0;
    padding: 0;
    font-size: 16px;
    font-weight: 400;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 920px;
    margin: 48px auto;
    background: var(--section-bg);
    box-shadow: var(--shadow-xl);
    border-radius: 20px;
    padding: 48px 40px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 20px 20px 0 0;
}

.header {
    display: flex;
    align-items: center;
    border-bottom: 2px solid var(--border);
    padding-bottom: 32px;
    margin-bottom: 40px;
    position: relative;
}

.photo {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary);
    margin-right: 36px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.photo:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-xl);
}

.photo::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: var(--gradient-primary);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.photo:hover::after {
    opacity: 0.1;
}

.photo img {
    transition: transform 0.3s ease;
}

.photo:hover img {
    transform: scale(1.1);
}

.header-info h1 {
    font-size: 2.75rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: var(--text);
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.header-info p {
    margin: 8px 0 16px 0;
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.5;
}

.contact-links {
    margin-top: 16px;
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.contact-links a {
    color: var(--primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--accent);
    border: 1px solid transparent;
    transition: all 0.2s ease;
    word-break: break-word;
}

.contact-links a:hover {
    background: var(--accent-hover);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.contact-links a:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.section {
    margin-bottom: 40px;
    transition: all 0.3s ease;
}

.section:last-child {
    margin-bottom: 0;
}

.section h2 {
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 16px;
    border-left: 4px solid var(--primary);
    padding-left: 12px;
    position: relative;
    letter-spacing: -0.01em;
}

.section h2::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

ul {
    margin: 16px 0 16px 20px;
    padding-left: 0;
}

li {
    margin-bottom: 12px;
    line-height: 1.7;
    color: var(--text);
}

li strong {
    color: var(--text);
    font-weight: 600;
}

li em {
    color: var(--text-secondary);
    font-style: normal;
    font-weight: 500;
    font-size: 0.9rem;
}

/* Nested lists styling */
li ul {
    margin: 8px 0 8px 20px;
}

li ul li {
    margin-bottom: 6px;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Project links styling */
.section a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.section a:hover {
    border-bottom-color: var(--primary);
    color: var(--primary-dark);
}

.section a:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 2px;
}

.skills-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.skill-block {
    background: var(--accent);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
    font-size: 0.95rem;
    text-align: left;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.skill-block:hover {
    background: var(--accent-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.skill-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.skill-block:hover::before {
    transform: scaleX(1);
}

.skill-block strong {
    color: var(--primary);
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.icon {
    width: 1.2em;
    height: 1.2em;
    vertical-align: text-bottom;
    margin-right: 8px;
    margin-left: 0;
    fill: currentColor;
    transition: all 0.2s ease;
}

.contact-links a:hover .icon {
    transform: scale(1.1);
}

/* Summary section enhancement */
.section p {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text);
    margin: 0 0 16px 0;
}

/* Achievement list styling */
.section:nth-last-child(3) ul li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.section:nth-last-child(3) ul li:last-child {
    border-bottom: none;
}

/* Better spacing for work experience */
.section ul li ul {
    margin-top: 8px;
    border-left: 2px solid var(--border);
    padding-left: 16px;
    margin-left: 4px;
}

.section ul li ul li {
    position: relative;
}

.section ul li ul li::before {
    content: '→';
    position: absolute;
    left: -20px;
    color: var(--primary);
    font-weight: bold;
}

/* Mobile-first responsive design */
@media (max-width: 768px) {
    .container {
        margin: 16px;
        padding: 20px 16px;
        border-radius: 8px;
        box-shadow: 0 0 12px #0001;
    }

    .header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding-bottom: 16px;
        margin-bottom: 24px;
    }

    .photo {
        margin-right: 0;
        margin-bottom: 16px;
        width: 100px;
        height: 100px;
    }

    .header-info h1 {
        font-size: 1.8em;
        margin-bottom: 8px;
    }

    .header-info p {
        font-size: 0.9em;
        margin-bottom: 12px;
    }

    .contact-links {
        display: flex;
        flex-direction: row;
        gap: 16px;
        align-items: center;
        justify-content: center;
        padding: 8px;
    }

    .contact-links a {
        margin-right: 0;
        font-size: 0.9em;
        padding: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--primary);
        color: white;
        border-radius: 50%;
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
    }

    .contact-links a:hover {
        background: var(--primary-dark);
        transform: translateY(-2px) scale(1.1);
    }

    .contact-links a span {
        display: none;
    }

    .contact-links a .icon {
        margin-right: 0;
        width: 1.5em;
        height: 1.5em;
    }

    .contact-links a:focus {
        outline: 3px solid white;
        outline-offset: 2px;
    }

    .section {
        margin-bottom: 24px;
    }

    .section h2 {
        font-size: 1.2em;
        margin-bottom: 12px;
    }

    .skills-list {
        flex-direction: column;
        gap: 8px;
    }

    .skill-block {
        padding: 10px 12px;
        font-size: 0.9em;
        text-align: left;
    }

    ul {
        margin: 8px 0 8px 12px;
        padding-left: 8px;
    }

    li {
        margin-bottom: 8px;
        font-size: 1em;
        line-height: 1.5;
    }
}

@media (max-width: 480px) {
    .container {
        margin: 8px;
        padding: 16px 12px;
    }

    .header-info h1 {
        font-size: 1.6em;
    }

    .header-info p {
        font-size: 0.85em;
    }

    .contact-links {
        gap: 12px;
    }

    .contact-links a {
        font-size: 0.85em;
        padding: 10px;
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    .contact-links a .icon {
        width: 1.4em;
        height: 1.4em;
    }

    .contact-links a:focus {
        outline: 3px solid white;
        outline-offset: 2px;
    }

    .section h2 {
        font-size: 1.1em;
    }

    .photo {
        width: 80px;
        height: 80px;
    }

    .skill-block {
        font-size: 0.85em;
        padding: 8px 10px;
    }

    li {
        font-size: 0.95em;
    }
}

/* Mobile touch and text improvements */
a {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Improve text wrapping for long content */
p,
li {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Better scrolling on mobile */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

/* Improve image rendering */
img {
    max-width: 100%;
    height: auto;
}

/* Print styles */
@media print {
    .container {
        box-shadow: none;
        border: 1px solid #ccc;
        margin: 0;
        padding: 20px;
    }

    .contact-links a {
        background: none;
        border: none;
        padding: 0;
    }

    .photo:hover,
    .skill-block:hover {
        transform: none;
        box-shadow: none;
    }
}

/* Larger desktop screens */
@media (min-width: 1200px) {
    .container {
        max-width: 1000px;
        padding: 56px 48px;
    }

    .header-info h1 {
        font-size: 3rem;
    }

    .skills-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Focus indicators for accessibility */
.container *:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Smooth animations */
* {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

/* Image Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: zoomIn 0.3s ease;
}

.modal-content img {
    width: auto;
    height: auto;
    max-width: 500px;
    max-height: 600px;
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    border: 4px solid var(--primary);
}

.modal-caption {
    background: var(--section-bg);
    color: var(--text);
    padding: 20px 24px;
    border-radius: 12px;
    text-align: center;
    margin-top: 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.modal-caption h3 {
    margin: 0 0 8px 0;
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-caption p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 1rem;
}

.close {
    position: absolute;
    top: -50px;
    right: 0;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close:hover {
    background: var(--primary);
    transform: scale(1.1);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes zoomIn {
    from { 
        opacity: 0;
        transform: scale(0.5);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

/* Modal responsive design */
@media (max-width: 768px) {
    .modal-content {
        max-width: 95%;
        max-height: 95%;
    }
    
    .modal-content img {
        max-width: 350px;
        max-height: 400px;
    }
    
    .modal-caption {
        padding: 16px 20px;
        margin-top: 16px;
    }
    
    .modal-caption h3 {
        font-size: 1.3rem;
    }
    
    .modal-caption p {
        font-size: 0.9rem;
    }
    
    .close {
        top: -40px;
        font-size: 30px;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .modal-content img {
        max-width: 280px;
        max-height: 350px;
    }
    
    .modal-caption {
        padding: 12px 16px;
        margin-top: 12px;
    }
    
    .modal-caption h3 {
        font-size: 1.2rem;
    }
    
    .modal-caption p {
        font-size: 0.85rem;
    }
}