/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 300;
    line-height: 1.6;
    color: #000;
    background-color: #fff;
    overflow-x: hidden;
    cursor: none;
}

/* Custom Cursor */
.cursor {
    position: fixed;
    width: 8px;
    height: 8px;
    background: #000;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: difference;
    transition: transform 0.1s ease;
}

.cursor-follower {
    position: fixed;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Header */
header {
    padding: 120px 40px 80px;
    max-width: 1200px;
    margin: 0 auto;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

h1 {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 200;
    letter-spacing: -2px;
    line-height: 0.9;
    margin-bottom: 60px;
    text-transform: uppercase;
}

.bio-text p {
    font-size: 16px;
    font-weight: 300;
    line-height: 1.8;
    max-width: 800px;
    margin-bottom: 40px;
    color: #333;
}

.bio-text a {
    color: #000;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
    font-weight: 400;
}

.bio-text a:hover {
    border-color: #000;
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
}

/* Section Styles */
.artwork-section,
.school-section {
    margin-bottom: 120px;
}

/* Section Titles */
h3 {
    font-size: 12px;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 80px 0 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

h4 {
    font-size: 12px;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 60px 0 30px;
    color: #666;
}

/* Project Lists */
.project-list {
    margin: 40px 0;
}

.project-entry {
    font-size: 11px;
    font-weight: 300;
    letter-spacing: 1px;
    margin: 8px 0;
    opacity: 0.7;
    padding-left: 20px;
    position: relative;
}

.project-entry::before {
    content: '—';
    position: absolute;
    left: 0;
    color: #ccc;
}

.project-entry.graded-entry::before {
    content: '★';
    color: #ddd;
}

/* Main Grid Container */
.flex-container {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 30px;
    margin: 60px 0;
    align-items: start;
}

/* Vertical Container for Right Side */
.flex-container-vertical {
    display: grid;
    grid-template-rows: auto auto auto;
    gap: 20px;
}

/* Project Items - Adaptive Heights */
.flex-item {
    position: relative;
    overflow: hidden;
    background: #f0f0f0;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    cursor: pointer;
    border-radius: 4px;
}

.flex-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.flex-item a {
    display: block;
    width: 100%;
    text-decoration: none;
    color: #000;
    position: relative;
}
/* 
/* Images - Natural Aspect Ratios */
.flex-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s ease;
    min-height: 200px;
    max-height: 500px;
    object-fit: cover;
}

/* Different sizing for main vs vertical items */
.flex-container > .flex-item:not(.flex-container-vertical) img {
    min-height: 300px;
    max-height: 600px;
}

.flex-container-vertical .flex-item img {
    min-height: 150px;
    max-height: 250px;
    aspect-ratio: 4/3;
    object-fit: cover;
}

.flex-item:hover img {
    transform: scale(1.02);
} 

/* Enhanced overlay for better text readability */
.flex-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0.1) 0%,
        rgba(0,0,0,0.2) 40%,
        rgba(0,0,0,0.6) 100%
    );
    z-index: 1;
    transition: background 0.3s ease;
    pointer-events: none;
}

.flex-item:hover::before {
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0.2) 0%,
        rgba(0,0,0,0.3) 40%,
        rgba(0,0,0,0.75) 100%
    );
}

/* Text styling with better positioning */
.flex-item h4 {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 1px;
    text-transform: none;
    color: #fff;
    z-index: 2;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    transition: transform 0.3s ease;
    line-height: 1.3;
}

.flex-item:hover h4 {
    transform: translateY(-5px);
}

/* Enhanced year labels */
.year-label {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 10px;
    letter-spacing: 1px;
    opacity: 0.9;
    font-weight: 300;
    z-index: 2;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
    background: rgba(0,0,0,0.3);
    padding: 4px 8px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.flex-item:hover .year-label {
    opacity: 1;
    transform: translateY(-5px);
    background: rgba(0,0,0,0.5);
}

/* Special styling for graded projects */
.graded::after {
    content: '★';
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 12px;
    opacity: 0.8;
    z-index: 2;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    background: rgba(255,215,0,0.2);
    padding: 4px 6px;
    border-radius: 50%;
}

/* School Projects - More uniform sizing */
.school-section .flex-container {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.school-section .flex-item {
    aspect-ratio: 4/3;
}

.school-section .flex-item img {
    height: 100%;
    object-fit: cover;
    aspect-ratio: 4/3;
}

/* Term 2 projects - smaller cards */
.school-section .flex-container:last-of-type {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.school-section .flex-container:last-of-type .flex-item {
    aspect-ratio: 3/2;
}

/* Fallback backgrounds if images fail to load */
.rul:not(:has(img)),
.rul img[style*="display: none"] + * {
    background: linear-gradient(135deg, #0f0f23, #1a1a3e);
}

.fluidDreams:not(:has(img)) {
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
}

.gaze:not(:has(img)) {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
}

.aavp:not(:has(img)) {
    background: linear-gradient(135deg, #f093fb, #f5576c);
}

.ant:not(:has(img)) {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.diasopra:not(:has(img)) {
    background: linear-gradient(135deg, #ffecd2, #fcb69f);
}

.board:not(:has(img)) {
    background: linear-gradient(135deg, #a8edea, #fed6e3);
}

.book:not(:has(img)) {
    background: linear-gradient(135deg, #ff9a9e, #fecfef);
}

.poem:not(:has(img)) {
    background: linear-gradient(135deg, #fad0c4, #ffd1ff);
}

.tomagochi:not(:has(img)) {
    background: linear-gradient(135deg, #a1c4fd, #c2e9fb);
}

.map:not(:has(img)) {
    background: linear-gradient(135deg, #d299c2, #fef9d7);
}

.bugs:not(:has(img)) {
    background: linear-gradient(135deg, #89f7fe, #66a6ff);
}

.peacehouse:not(:has(img)) {
    background: linear-gradient(135deg, #fdbb2d, #22c1c3);
}

/* Animations */
.fade-in {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Loading Animation */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(60px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.flex-item {
    animation: slideUp 0.8s cubic-bezier(0.23, 1, 0.32, 1) forwards;
    opacity: 0;
}

.flex-item:nth-child(1) { animation-delay: 0.1s; }
.flex-item:nth-child(2) { animation-delay: 0.2s; }
.flex-container-vertical .flex-item:nth-child(1) { animation-delay: 0.3s; }
.flex-container-vertical .flex-item:nth-child(2) { animation-delay: 0.4s; }
.flex-container-vertical .flex-item:nth-child(3) { animation-delay: 0.5s; }

/* Staggered animations for school sections */
.school-section .flex-item:nth-child(1) { animation-delay: 0.2s; }
.school-section .flex-item:nth-child(2) { animation-delay: 0.3s; }
.school-section .flex-item:nth-child(3) { animation-delay: 0.4s; }
.school-section .flex-item:nth-child(4) { animation-delay: 0.5s; }
.school-section .flex-item:nth-child(5) { animation-delay: 0.6s; }

/* Loading states */
.loading {
    overflow: hidden;
}

.loading .flex-item {
    animation-play-state: paused;
}

/* Image loading states */
.flex-item img {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.flex-item img.loaded {
    opacity: 1;
}

/* Enhanced visual effects */
.flex-item {
    will-change: transform;
}

.flex-item:hover {
    box-shadow: 
        0 20px 40px rgba(0,0,0,0.15),
        0 0 0 1px rgba(255,255,255,0.1) inset;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .flex-container {
        grid-template-columns: 1fr 1fr;
        gap: 25px;
    }
    
    .flex-container-vertical {
        grid-column: span 2;
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: auto;
        gap: 20px;
    }
    
    .flex-container-vertical .flex-item img {
        aspect-ratio: 4/3;
        min-height: 180px;
        max-height: 220px;
    }
}

@media (max-width: 768px) {
    header, main {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    h1 {
        font-size: clamp(2rem, 12vw, 4rem);
    }
    
    .flex-container {
        grid-template-columns: 1fr;
        gap: 20px;
        margin: 40px 0;
    }
    
    .flex-container-vertical {
        grid-column: span 1;
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .flex-item {
        aspect-ratio: 16/9;
    }
    
    .flex-item img {
        height: 100%;
        aspect-ratio: 16/9;
        object-fit: cover;
        min-height: auto;
        max-height: none;
    }
    
    .flex-item h4 {
        font-size: 12px;
        bottom: 15px;
        left: 15px;
        right: 15px;
    }
    
    .year-label {
        font-size: 9px;
        top: 15px;
        right: 15px;
        padding: 3px 6px;
    }
}

@media (max-width: 480px) {
    body {
        cursor: auto;
    }
    
    .cursor,
    .cursor-follower {
        display: none;
    }
    
    header {
        padding-top: 80px;
    }
    
    .flex-container {
        gap: 15px;
        margin: 30px 0;
    }
    
    .flex-item {
        aspect-ratio: 4/3;
    }
    
    .flex-item h4 {
        font-size: 11px;
        bottom: 12px;
        left: 12px;
        right: 12px;
        line-height: 1.2;
    }
    
    .year-label {
        top: 12px;
        right: 12px;
        font-size: 8px;
        padding: 2px 5px;
    }
    
    .graded::after {
        top: 12px;
        left: 12px;
        font-size: 10px;
        padding: 3px 5px;
    }
}

/* Footer */
footer {
    padding: 40px;
    text-align: center;
    font-size: 0.9rem;
    color: #999;
    letter-spacing: 1px;
}

/* Additional polish */
.js-enabled .flex-item {
    will-change: transform;
}

.js-enabled .cursor,
.js-enabled .cursor-follower {
    will-change: transform;
}

/* Force images to show - debugging */
.flex-item img {
    opacity: 1 !important;
}