/* Font face optimization for faster loading */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap; /* Prevent invisible text during font swap */
}

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

/* Body styling */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1a1a1a;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Smooth page transitions */
    opacity: 0;
    animation: fadeIn 0.3s ease-in-out forwards;
}

/* Page fade-in animation */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Container with responsive width */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Header and navigation */
header {
    padding: 32px 0;
    border-bottom: 1px solid #f0f0f0;
}

.nav-v3 {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
}

.landing-link-about {
    color: #666666;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
    letter-spacing: -0.01em;
    position: relative;
}

/* Smooth navigation hover effect */
.landing-link-about::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: -2px;
    left: 50%;
    background-color: #1a1a1a;
    transition: all 0.3s ease;
}

.landing-link-about:hover::after {
    width: 100%;
    left: 0;
}

.landing-link-about:hover {
    color: #1a1a1a;
}

.landing-link-about.w--current {
    color: #1a1a1a;
    font-weight: 600;
}

/* Main content area */
main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.intro {
    text-align: center;
    width: 100%;
    padding: 80px 0;
}

.headshot {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 32px;
    border: 3px solid #f0f0f0;
    transition: border-color 0.2s ease;
}

.headshot:hover {
    border-color: #e0e0e0;
}

/* Headshot loading animation */
.headshot-container {
    position: relative;
    display: inline-block;
    margin-bottom: 32px;
}

.headshot-container.loading::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top: 3px solid #007bff;
    border-right: 3px solid #007bff;
    animation: headshotSpin 1s linear infinite;
    z-index: 1;
}

.headshot-container.loading .headshot {
    opacity: 0.7;
    border-color: transparent;
}

@keyframes headshotSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.landing-intro-bio {
    color: #1a1a1a;
    font-size: 48px;
    font-weight: 700;
    line-height: 1.1;
    margin: 0;
    letter-spacing: -0.02em;
}

/* Subtitle for the pictures page */
.subtitle {
    color: #666666;
    font-size: 18px;
    line-height: 1.5;
    max-width: 600px;
    margin: 0 auto 48px;
    text-align: center;
    font-weight: 400;
}

/* Contact section styling */
.contact {
    text-align: center;
    padding: 40px 0;
    margin-top: 40px;
}

.contact-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.contact-title {
    color: #666666;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

.contact-email {
    color: #1a1a1a;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

.contact-social {
    color: #666666;
    font-size: 16px;
    font-weight: 400;
    margin: 0;
}

.contact-social a {
    color: #1a1a1a;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.contact-social a:hover {
    color: #666666;
}

/* Pictures page grid */
.pictures-page {
    width: 100%;
    margin: 0 auto;
    padding: 60px 0;
    background: #fafafa;
    min-height: 80vh;
}

/* Gallery container */
.image-gallery {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    grid-auto-flow: row;
}

/* Individual photo card */
.photo-card {
    width: 100%;
    aspect-ratio: 1;
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.08),
        0 1px 4px rgba(0, 0, 0, 0.04);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    /* Performance optimizations */
    will-change: transform;
    transform: translateZ(0); /* Enable hardware acceleration */
}

.photo-card:hover {
    transform: translateY(-8px);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.12),
        0 4px 16px rgba(0, 0, 0, 0.08);
}

/* Image wrapper for blur-up effect */
.image-wrapper {
    position: relative;
    width: 100%;
    flex: 1;
    overflow: hidden;
    background: #f5f5f5;
}

/* Placeholder image (low quality, loads first) */
.photo-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(10px);
    transform: scale(1.1);
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Main image (high quality, loads after) */
.photo-main {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease, opacity 0.3s ease;
    opacity: 0;
    z-index: 2;
}

/* When image is loaded, show main image and hide placeholder */
.photo-card.loaded .photo-main {
    opacity: 1;
}

.photo-card.loaded .photo-placeholder {
    opacity: 0;
}

.photo-card:hover .photo-main {
    transform: scale(1.05);
}

/* Loading state */
.photo-card.loading {
    background: #f5f5f5;
}

.photo-card.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, #007bff, transparent);
    animation: loading 1.5s infinite;
    z-index: 10;
}

/* Error state */
.photo-card.error {
    background: #fff5f5;
    border: 1px solid #fed7d7;
}

.photo-card.error .image-wrapper {
    background: #fed7d7;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c53030;
    font-size: 14px;
}

.photo-card.error .image-wrapper::before {
    content: '⚠ Failed to load image';
}

/* Caption area */
.photo-caption {
    padding: 18px 20px 20px 20px;
    background: #ffffff;
    flex-shrink: 0;
}

.photo-date {
    font-size: 10px;
    color: #8a8a8a;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    line-height: 1;
}

.photo-title {
    font-size: 13px;
    color: #2a2a2a;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Modal styles for full-size viewing */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease;
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.modal-image {
    width: 100%;
    height: auto;
    display: block;
    max-height: 75vh;
    object-fit: contain;
}

.modal-info {
    padding: 30px 35px;
    background: #ffffff;
    text-align: center;
    border-top: 1px solid #f0f0f0;
}

.modal-date {
    font-size: 13px;
    color: #8a8a8a;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.modal-caption {
    font-size: 20px;
    color: #2a2a2a;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
}

/* Close button */
.modal-close {
    position: absolute;
    top: 25px;
    right: 30px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
    color: #2a2a2a;
    font-weight: 300;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

/* Loading animation */
@keyframes loading {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Modal animations */
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Performance-first loading animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .photo-card {
        transition: none;
    }
    
    .photo-main {
        transition: opacity 0.1s ease;
    }
    
    @keyframes loading {
        0%, 100% { opacity: 0.5; }
        50% { opacity: 1; }
    }
}

/* Projects grid */
.projects-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    padding: 48px 0;
    max-width: 800px;
    margin: 0 auto;
}

/* Project Card Styles */
.project-card {
    background-color: #fafafa;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    border-color: #e0e0e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.project-card h3 {
    margin: 0 0 12px 0;
    color: #1a1a1a;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.project-card p {
    color: #666666;
    margin-bottom: 16px;
    line-height: 1.5;
    flex-grow: 1;
}

/* Project Link */
.project-link {
    display: inline-block;
    color: #1a1a1a;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    transition: color 0.2s ease;
    margin-top: auto;
}

.project-link:hover:not(.disabled) {
    color: #666666;
}

.project-link.disabled {
    color: #cccccc;
    cursor: not-allowed;
}

/* Project Modal */
.project-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
}

.project-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease;
}

.project-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    width: 100%;
    max-width: 1000px;
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.15);
    animation: modalSlideIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.project-modal-scroll {
    height: 90vh;
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* Close button */
.project-modal-close {
    position: absolute;
    top: 25px;
    right: 30px;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
    color: #2a2a2a;
    font-weight: 300;
    z-index: 1001;
}

.project-modal-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
}

/* Modal README Section */
.project-modal-readme {
    padding: 40px 40px 20px 40px;
    background: #ffffff;
}

.project-title-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.readme-content h1 {
    color: #1a1a1a;
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
}

.readme-content p {
    color: #666666;
    line-height: 1.6;
    margin-bottom: 12px;
    font-size: 16px;
}

.readme-content p:last-child {
    margin-bottom: 0;
}

.readme-content hr {
    border: none;
    height: 1px;
    background: #e0e0e0;
    margin: 20px 0 0 0;
}

.project-links {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.project-links a {
    display: inline-block;
    color: #1a1a1a;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    transition: all 0.2s ease;
}

.project-links a:hover {
    color: #666666;
}

.github-link {
    display: inline-block;
    transition: transform 0.2s ease;
}

.github-link:hover {
    transform: scale(1.1);
}

.github-logo {
    width: 32px;
    height: 32px;
    filter: grayscale(0.2);
    transition: filter 0.2s ease;
}

.github-logo:hover {
    filter: grayscale(0);
}

/* Modal Demo Section */
.project-modal-demo {
    padding: 8px 40px 40px 40px;
    background: #ffffff;
    min-height: calc(90vh - 200px);
}

.project-modal-demo h3 {
    color: #1a1a1a;
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 16px 0;
}

.game-container {
    background: #000000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    max-width: 740px;
    margin-left: auto;
    margin-right: auto;
}

.game-container iframe {
    display: block;
    border: none;
    width: 100%;
    border-radius: 12px;
    height: 540px;
}

.game-instructions {
    color: #666666;
    font-size: 14px;
    text-align: center;
    margin: 0;
    font-style: italic;
}

/* Responsive breakpoints */
@media screen and (max-width: 1200px) {
    .image-gallery {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 25px;
        padding: 0 30px;
    }
}

@media screen and (max-width: 991px) {
    .landing-intro-bio {
        font-size: 40px;
    }
    
    .intro {
        padding: 60px 0;
    }
    
    .headshot {
        width: 160px;
        height: 160px;
        margin-bottom: 24px;
    }

    .subtitle {
        font-size: 16px;
    }
    
    .pictures-page {
        padding: 40px 0;
    }
    
    .image-gallery {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 20px;
        padding: 0 25px;
    }
    
    .photo-card {
        border-radius: 12px;
    }
    
    .photo-caption {
        padding: 15px 18px 18px 18px;
    }
    
    .photo-date {
        font-size: 9px;
    }
    
    .photo-title {
        font-size: 12px;
    }
}

@media screen and (max-width: 767px) {
    .container {
        padding: 0 20px;
    }
    
    .header {
        padding: 24px 0;
    }
    
    .nav-v3 {
        gap: 24px;
    }
    
    .contact {
        padding: 32px 0;
    }
    
    .pictures-page {
        padding: 30px 0;
    }
    
    .image-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        padding: 0 20px;
    }
    
    .photo-card {
        border-radius: 10px;
    }
    
    .photo-caption {
        padding: 12px 14px 16px 14px;
    }
    
    .photo-date {
        font-size: 9px;
        margin-bottom: 4px;
    }
    
    .photo-title {
        font-size: 11px;
        line-height: 1.2;
        -webkit-line-clamp: 2;
    }
    
    .modal-content {
        max-width: 95vw;
        max-height: 95vh;
        border-radius: 16px;
    }
    
    .modal-info {
        padding: 20px 25px;
    }
    
    .modal-close {
        top: 15px;
        right: 20px;
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .projects-container {
        grid-template-columns: 1fr;
    }
    
    .project-modal-content {
        max-width: 95vw;
        max-height: 95vh;
        border-radius: 16px;
    }
    
    .project-modal-readme {
        padding: 24px 24px 16px 24px;
    }
    
    .project-modal-demo {
        padding: 8px 24px 24px 24px;
    }
    
    .readme-content h1 {
        font-size: 24px;
    }
    
    .project-title-header {
        gap: 12px;
    }
    
    .project-modal-close {
        top: 15px;
        right: 20px;
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

@media screen and (max-width: 479px) {
    .landing-intro-bio {
        font-size: 32px;
    }
    
    .intro {
        padding: 40px 0;
    }
    
    .headshot {
        width: 120px;
        height: 120px;
        margin-bottom: 20px;
    }

    .subtitle {
        font-size: 15px;
    }

    .nav-v3 {
        flex-wrap: wrap;
        gap: 16px;
    }

    .pictures-page {
        padding: 20px 0;
    }
    
    .image-gallery {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 16px;
    }
    
    .photo-card {
        border-radius: 8px;
        max-width: 400px;
        margin: 0 auto;
    }
    
    .photo-caption {
        padding: 14px 16px 18px 16px;
    }
    
    .photo-date {
        font-size: 10px;
        margin-bottom: 6px;
    }
    
    .photo-title {
        font-size: 12px;
        line-height: 1.3;
    }
    
    .modal-info {
        padding: 16px 20px;
    }
    
    .modal-date {
        font-size: 11px;
    }
    
    .modal-caption {
        font-size: 16px;
    }
    
    .project-modal-readme {
        padding: 20px 20px 16px 20px;
    }
    
    .project-modal-demo {
        padding: 8px 20px 20px 20px;
    }
    
    .readme-content h1 {
        font-size: 22px;
    }
    
    .project-title-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}
