/* --- Basic Reset & Globals --- */
:root {
    --background-color: #ffffff;
    --text-color: #3a3a3a;
    --header-color: #3a3a3a;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

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

/* --- Header & Footer --- */
.page-header, .site-footer {
    font-family: 'Times New Roman', serif;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
    color: var(--header-color);
    background-color: var(--background-color);
}

.header {
    text-align: center;

}

.header h1 {
    margin-bottom: 0;
    font-family: 'Times New Roman', serif;
    font-size: 3rem;
    font-weight: 400;
    letter-spacing: 0.4rem;
    text-transform: uppercase;
    color: var(--header-color);
}

.header .subtitle {
    font-size: 0.75rem;
    letter-spacing: 0.2rem;
    text-transform: uppercase;
    color: rgba(23, 23, 23, 0.7);
    margin-top: 0.8rem;
}

/* --- NEW: Main Navigation Styling --- */
.main-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap; /* Allows links to wrap on smaller screens */
    justify-content: center;
    gap: 2rem; 
}

.main-navigation a {
    text-decoration: none;
    color: rgba(55, 55, 55, 0.85);
    font-size: 0.8rem;
    letter-spacing: 0.1rem;
    text-transform: uppercase;
    transition: color 0.2s ease-in-out;
}

.main-navigation a:hover {
    color: #fff; /* A nice highlight color on hover */
}

/* --- Basic Page Content Styling --- */
.page-content {
    max-width: 800px; /* A comfortable reading width */
    margin: 2rem auto; /* Centers the block and adds space top/bottom */
    padding: 0 1rem;   /* Adds space on the sides for smaller screens */
    line-height: 1.7;  /* Increases space between lines of text */
}

.page-content h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.profile-picture {
    display: block;
    max-width: 200px;
    max-height: 200px;
    border-radius: 50%; /* Makes the image a circle */
    margin: 0 auto 2rem; /* Centers the image and adds space below it */
    box-shadow: 0 4px 12px var(--shadow-color);
    object-fit: cover;
}

/* --- The Main Portfolio Grid --- */
.image-grid {
    display: grid;
    /* This makes as many 280px columns as can fit, growing to fill the space */
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
    max-width: 1600px;
    margin: 0 auto; /* Center the grid */
}

/* -------------------------------------------------- */
/* Image Grid Animations */
/* -------------------------------------------------- */

/* Hide thumbnails by default until the animation applies */
.thumbnail-card {
    opacity: 0;
    /* Use 'top' property for initial positioning instead of 'transform: translateY' */
    position: relative; /* Required for 'top' to work as intended */
    top: 20px; 
    
    animation-name: fadeInUpFix; /* Renamed keyframes */
    animation-duration: 0.5s;
    animation-fill-mode: forwards; /* Keep the final state (visible) */
    animation-timing-function: ease-out;

    /* Existing styles remain here */
    display: block;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease, top 0.3s ease; /* Add top to transition */
    aspect-ratio: 1 / 1.2; 
}

/* Keyframe animation for fading in and moving up slightly */
@keyframes fadeInUpFix {
    to {
        opacity: 1;
        /* Animate 'top' back to its default position */
        top: 0; 
    }
}

/* Apply staggered delays using CSS :nth-child selector */
/* ... (nth-child selectors remain the same) ... */
.thumbnail-card:nth-child(1) { animation-delay: 0.1s; }
.thumbnail-card:nth-child(2) { animation-delay: 0.2s; }
.thumbnail-card:nth-child(3) { animation-delay: 0.3s; }
.thumbnail-card:nth-child(4) { animation-delay: 0.4s; }
.thumbnail-card:nth-child(5) { animation-delay: 0.5s; }
.thumbnail-card:nth-child(6) { animation-delay: 0.6s; }
.thumbnail-card:nth-child(7) { animation-delay: 0.7s; }
.thumbnail-card:nth-child(8) { animation-delay: 0.8s; }
.thumbnail-card:nth-child(9) { animation-delay: 0.9s; }

/* --- Individual Thumbnail Cards (The Cropping Container) --- */
.thumbnail-card {
    display: block;
    position: relative; /* Crucial for positioning the overlay */
    overflow: hidden; /* Hides the parts of the image that are cropped */
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    aspect-ratio: 1 / 1.2; 
}

.thumbnail-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* --- The Image inside the Card --- */
.thumbnail-card img {
    width: 100%;
    height: 100%;
    display: block;

    /* This makes the image cover the square container, cropping the excess */
    object-fit: cover; 
    object-position: center; /* Ensures cropping is centered */
    
    /* Transition for the darkening effect */
    transition: filter 0.3s ease;
}

/* --- Darkening Effect and Overlay on Hover --- */
.thumbnail-card:hover img {
    /* This darkens the image itself */
    filter: brightness(0.6);
}

.thumbnail-card .overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    color: white;
    padding: 2rem 1rem 1rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none; /* Allows clicks to go through to the link */
    
    /* We remove the background gradient so the image darkening shows through */
    background: none; 
}

.thumbnail-card:hover .overlay {
    opacity: 1;
    transform: translateY(0);
}

.overlay .title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5); /* Adds readability */
}

/* --- Lightbox Styles --- */
.lightbox {
    position: fixed; /* Stays in place even when scrolling */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 9999;

    /* Centering the image container */
    display: flex;
    justify-content: center;
    align-items: center;

    /* ANIMATION PART 1: Initial state is hidden */
    opacity: 0;
    pointer-events: none;
    visibility: hidden; /* Ensures no interaction when hidden */
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* This class will be added by JavaScript to show the lightbox */
.lightbox.active {
    /* ANIMATION PART 2: Final state is visible */
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;   /* Max 90% of viewport width */
    max-height: 90vh;  /* Max 90% of viewport height */
}

#lightbox-img {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    image-rendering: crisp-edges; 
    border-radius: 4px;

    /* ANIMATION PART 3: Image transition */
    transform: scale(0.95); /* Start slightly smaller for zoom effect */
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* ANIMATION PART 4: When active, animate the image to full size/opacity */
.lightbox.active #lightbox-img {
    transform: scale(1);
    opacity: 1;
}


/* --- Lightbox Buttons --- */
.lightbox-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(30, 30, 30, 0.6);
    color: white;
    border: none;
    font-size: 2.5rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    user-select: none; /* Prevents text selection on double click */
    transition: background-color 0.2s ease, transform 0.1s ease; /* Added transform transition for flash */
}

.lightbox-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

/* Added active state for a 'flash' when clicked */
.lightbox-btn:active {
    transform: translateY(-50%) scale(0.9);
}

.prev-btn {
    left: 1rem;
}

.next-btn {
    right: 1rem;
}

.close-btn {
    top: 1rem;
    right: 1rem;
    transform: none; /* Override the translateY for vertical center */
    font-size: 3rem;
    line-height: 1;
    padding: 0 1rem;
}

/* Added active state for the close button "flash" */
.close-btn:active {
    transform: scale(0.9);
}
