body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    background-color: #fff;
    color: #1d1d1f;
    line-height: 1.5;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

header {
    padding: 6rem 0 3rem 0;
    text-align: center;
    position: relative;
    z-index: 10;
}

/* Theme toggle button */
.theme-toggle {
    position: absolute;
    top: 24px;
    right: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    color: #1d1d1f;
    background: rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.08);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.theme-toggle:hover {
    background: rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.theme-toggle .sun { display: inline; }
.theme-toggle .moon { display: none; }

body.dark .theme-toggle {
    color: #f5f5f7;
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
}

body.dark .theme-toggle:hover {
    background: rgba(255,255,255,0.1);
}

body.dark .theme-toggle .sun { display: none; }
body.dark .theme-toggle .moon { display: inline; }

header h1 {
    margin: 0;
    font-weight: 700;
    font-size: 6rem;
    letter-spacing: -0.02em;
    color: #1d1d1f;
    animation: slideInDown 1s ease-out;
}

body.dark header h1 {
    color: #f5f5f7;
}

header h1 .lab-gradient {
    background: linear-gradient(135deg, #007AFF 0%, #0051D5 25%, #1E90FF 50%, #4169E1 75%, #0066CC 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header h1 .ai-gradient {
    background: linear-gradient(135deg, 
        #FF0080 0%, 
        #7928CA 20%, 
        #00D4FF 40%, 
        #FF0080 60%, 
        #7928CA 80%, 
        #00D4FF 100%);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    display: inline-block;
    font-weight: 800;
    letter-spacing: 0.02em;
    animation: aiFlow 8s ease-in-out infinite, aiPulse 5s ease-in-out infinite alternate;
}

header .subtitle {
    max-width: 780px;
    margin: 1.5rem auto 0 auto;
    font-size: 1.8rem;
    font-weight: 400;
    color: #6e6e73;
    line-height: 1.5;
    animation: slideInUp 1s ease-out 0.2s both;
}

body.dark header .subtitle {
    color: #a1a1aa;
}

header .description {
    display: none;
}

main {
    padding: 8rem 0 4rem 0;
    margin-bottom: 3rem;
}

.app-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12rem;
    max-width: 1800px;
    margin: 0 auto;
}

.app {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 4rem;
    align-items: center;
    text-decoration: none;
    color: inherit;
    position: relative;
    min-height: 500px;
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.4s ease;
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.03) 0%, rgba(88, 86, 214, 0.02) 100%);
    border-radius: 20px;
    padding: 2rem;
    overflow: hidden;
}

body.dark .app {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.06) 0%, rgba(88, 86, 214, 0.05) 100%);
}

.app.animate {
    opacity: 1;
    transform: translateY(0);
}

.app::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.08) 0%, rgba(88, 86, 214, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
    border-radius: 20px;
}

body.dark .app::before {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.12) 0%, rgba(88, 86, 214, 0.1) 100%);
}

.app:hover::before {
    opacity: 1;
}

.app:nth-child(even) {
    grid-template-columns: 0.8fr 1.2fr;
}

.app:nth-child(even) .app-image {
    order: 2;
}

.app:nth-child(even) .app-content {
    order: 1;
}

.app-image {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 720px;
    overflow: visible;
}

.app img {
    width: 120%;
    height: 720px;
    object-fit: contain;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    animation: float 4s ease-in-out infinite;
}

/* Dual-shot layout for projects with two images (e.g., Rebalancer) */
.app .dual-shot {
    position: relative;
    width: 100%;
    height: 100%;
}

.app .dual-shot .shot {
    position: absolute;
    display: block;
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
    height: auto;           /* override generic .app img */
    width: auto;            /* override generic .app img */
    max-width: 72%;
    max-height: 88%;
    object-fit: cover;
    animation: none;        /* disable float for layered shots */
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.app .dual-shot .primary {
    left: 68%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;               /* on top */
    max-width: 58%;           /* smaller and to the side */
}

.app .dual-shot .secondary {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(-2deg);
    z-index: 1;               /* behind */
    max-width: 110%;          /* much larger background */
    max-height: 95%;
    opacity: 0.98;
}

/* Neutralize global hover effect for layered shots */
.app:hover .dual-shot .shot {
    transform: translate(-50%, -50%);
}

.app:hover .dual-shot .primary {
    transform: translate(-50%, -52%) scale(1.01);
}

.app:hover .dual-shot .secondary {
    transform: translate(-50%, -50%) rotate(-2deg) scale(1.005);
}

/* 3 Tasks image - still 20% smaller than the new larger base */
.app[data-index="1"] img {
    width: 96%;
    height: 576px;
    border-radius: 16px;
}

.app[data-index="1"] .app-image {
    height: 576px;
}

/* Brainy image - reduced to fit container */
.app[data-index="5"] img {
    width: 126%;
    height: 756px;
}

.app[data-index="5"] .app-image {
    height: 756px;
}

.app:hover img {
    transform: translateY(-10px) rotateX(5deg) rotateY(5deg);
}

.app-content {
    padding: 2rem;
}

.app-content h3 {
    font-size: 2.8rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    line-height: 1.2;
    color: #1d1d1f;
}

body.dark .app-content h3 {
    color: #e5e7eb;
}

.app-content .category {
    font-size: 1rem;
    color: #007AFF;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
}

.app-content .description {
    font-size: 1.5rem;
    color: #6e6e73;
    margin-bottom: 2rem;
    line-height: 1.6;
}

body.dark .app-content .description {
    color: #a1a1aa;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    min-width: 140px;
    text-align: center;
    letter-spacing: -0.01em;
    position: relative;
    overflow: hidden;
}

.download-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.download-btn:hover::before {
    left: 100%;
}

.download-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 25px rgba(0, 122, 255, 0.4);
}

.download-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

footer {
    padding: 6rem 0;
    text-align: center;
    margin-top: 8rem;
    font-size: 1.1rem;
    color: #6e6e73;
}

body.dark footer {
    color: #9ca3af;
}

/* Dark mode base */
body.dark {
    background-color: #0b0b0c;
    color: #e5e7eb;
}

/* GitHub Project Styles */
.github-project {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.05) 0%, rgba(88, 86, 214, 0.03) 100%);
    border-radius: 20px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}



.github-project .app-image {
    perspective: 1000px;
    transform-style: preserve-3d;
}

.github-project img {
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.github-project:hover img {
    transform: translateY(-15px) rotateX(8deg) rotateY(-5deg) scale(1.02);
    box-shadow: 0 25px 60px rgba(0, 122, 255, 0.3);
}



.github-project .category {
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
}



/* Foro specific styling */
.app[data-index="0"] img {
    width: 115%;
    height: 690px;
    border-radius: 16px;
}

.app[data-index="0"] .app-image {
    height: 690px;
}



/* Animations */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-8px);
    }
}

@keyframes aiFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes aiPulse {
    0% {
        filter: brightness(1);
        transform: scale(1);
    }
    100% {
        filter: brightness(1.05);
        transform: scale(1.01);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    header {
        padding: 4rem 0 2rem 0;
    }
    
    header h1 {
        font-size: 4rem;
    }
    
    header .subtitle {
        font-size: 1.5rem;
    }
    
    main {
        padding: 6rem 0 3rem 0;
    }
    
    .app-grid {
        gap: 8rem;
    }
    
    .app {
        grid-template-columns: 1fr !important;
        text-align: center;
        gap: 2rem;
        min-height: auto;
        padding: 1.5rem;
    }
    
    .app-image {
        order: 1 !important;
        height: 600px;
    }
    
    .app img {
        width: 120%;
        height: 600px;
    }

    /* Dual-shot mobile sizing */
    .app .dual-shot .primary {
        left: 68%;
        max-width: 66%;
        transform: translate(-50%, -50%);
    }
    .app .dual-shot .secondary {
        max-width: 102%;
        transform: translate(-50%, -50%) rotate(-2deg);
    }
    
    /* Mobile adjustments for specific images */
    .app[data-index="1"] img {
        width: 96%;
        height: 480px;
        border-radius: 16px;
    }
    
    .app[data-index="1"] .app-image {
        height: 480px;
    }
    
    .app[data-index="5"] img {
        width: 126%;
        height: 630px;
    }
    
    .app[data-index="5"] .app-image {
        height: 630px;
    }
    
    /* Foro mobile adjustments */
    .app[data-index="0"] img {
        width: 115%;
        height: 552px;
    }
    
    .app[data-index="0"] .app-image {
        height: 552px;
    }
    
    .github-project {
        padding: 1.5rem;
    }
    
    .app-content {
        order: 2 !important;
        padding: 1rem;
    }
    
    .app-content h3 {
        font-size: 2.2rem;
    }
    
    .app-content .description {
        font-size: 1.3rem;
    }
    
    footer {
        padding: 4rem 0;
        margin-top: 6rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 3rem;
    }
    
    header .subtitle {
        font-size: 1.3rem;
    }
    
    main {
        padding: 4rem 0 2rem 0;
    }
    
    .app-grid {
        gap: 6rem;
    }
    
    .app-image {
        height: 480px;
    }
    
    .app img {
        width: 120%;
        height: 480px;
    }

    /* Dual-shot small mobile sizing */
    .app .dual-shot .primary {
        left: 70%;
        max-width: 72%;
        transform: translate(-50%, -50%);
    }
    .app .dual-shot .secondary {
        max-width: 104%;
        transform: translate(-50%, -50%) rotate(-2deg);
    }
    
    /* Mobile adjustments for specific images */
    .app[data-index="1"] img {
        width: 96%;
        height: 384px;
        border-radius: 16px;
    }
    
    .app[data-index="1"] .app-image {
        height: 384px;
    }
    
    .app[data-index="5"] img {
        width: 126%;
        height: 504px;
    }
    
    .app[data-index="5"] .app-image {
        height: 504px;
    }
    
    /* Foro small mobile adjustments */
    .app[data-index="0"] img {
        width: 115%;
        height: 442px;
    }
    
    .app[data-index="0"] .app-image {
        height: 442px;
    }
    
    .github-project {
        padding: 1rem;
    }
    
    .app {
        gap: 1.5rem;
        padding: 1rem;
    }
    
    .app-content h3 {
        font-size: 1.9rem;
    }
    
    .app-content .description {
        font-size: 1.2rem;
    }
    
    footer {
        padding: 3rem 0;
        margin-top: 4rem;
    }
}
