/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-color: #050505;
    --card-bg: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-color: #3b82f6;
    /* Blue accent */
    --accent-hover: #2563eb;
    --glass-bg: rgba(20, 20, 20, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --transition-speed: 0.3s;
    --column-gap: 20px;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    overflow-x: hidden;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* --- Header & Nav --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    padding: 1.2rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    transition: transform var(--transition-speed) ease, background var(--transition-speed) ease;
}

.navbar.hidden {
    transform: translateY(-100%);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #a5a5a5 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo span {
    color: var(--accent-color);
    -webkit-text-fill-color: var(--accent-color);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.github-link {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.github-icon {
    width: 24px;
    height: 24px;
    filter: invert(1); /* Makes the icon white to match the theme */
    transition: transform 0.3s ease, filter 0.3s ease;
}

.github-link:hover .github-icon {
    transform: scale(1.1);
    filter: invert(0.7) brightness(1.2);
}

.filters {
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    padding: 5px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}



.filter-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.filter-btn.active {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* --- Hero Section --- */
.hero {
    margin-top: 80px;
    padding: 4rem 5%;
    /* Adjusted padding */
    text-align: center;
    max-width: 800px;
    margin-left: auto;
    /* Center horizontally */
    margin-right: auto;
}

.hero h1 {
    font-size: 3.5rem;
    /* Large and bold */
    line-height: 1.1;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #ffffff, #666666);
    /* Gradient text */
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero h1 span {
    color: var(--accent-color);
    -webkit-text-fill-color: var(--accent-color);
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

/* --- Gallery Grid (Masonry) --- */
.gallery-container {
    padding: 2rem 5% 4rem;
}

.gallery-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 20px;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.gallery-grid[data-ready="true"] {
    opacity: 1;
    transform: translateY(0);
}

.gallery-column {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px;
}

/* Responsive Columns */
@media (max-width: 1600px) {
    .gallery-grid {
        max-width: 1400px;
        margin: 0 auto;
    }
}

@media (max-width: 1200px) {
    .gallery-grid {
        gap: 15px;
    }
}

@media (max-width: 800px) {
    .gallery-grid {
        gap: 10px;
    }
}

.gallery-item {
    margin-bottom: 20px;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: var(--card-bg);
    transform: translateZ(0);
    /* Fix for webkit rendering */
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.5s ease;
    cursor: zoom-in;
}

.gallery-item.opacity-0 {
    opacity: 0;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    opacity: 0;
    /* Hidden initially for fade-in */
    transition: opacity 0.5s ease, transform 0.5s ease;
    min-height: 150px; /* Reserve space to prevent layout shift */
}

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

/* Placeholder effect while loading */
.gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, #1a1a1a, #2a2a2a, #1a1a1a);
    background-size: 200% 200%;
    animation: shimmer 1.5s infinite;
    z-index: 1;
}

.gallery-item.loaded::before {
    display: none;
}

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

.gallery-item:hover img {
    transform: scale(1.03);
}

/* Overlay for buttons/info provided later */
.item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.gallery-item:hover .item-overlay {
    opacity: 1;
}

.item-badge {
    background: rgba(255, 255, 255, 0.2);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    color: white;
    font-weight: 500;
}

/* --- Loading Spinner --- */
.loader-container {
    padding: 40px 0;
    text-align: center;
    /* meaningful height for intersection observer */
    min-height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loader-container .spinner {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.loader-container.active .spinner {
    opacity: 1;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Lightbox --- */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    pointer-events: all;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90vh;
    position: relative;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-img {
    max-width: 100%;
    max-height: 90vh;
    display: block;
    border-radius: 4px;
    -webkit-user-select: none;
    user-select: none;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    transition: all 0.2s;
    z-index: 1001;
    /* Ensure above image */
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.end-message {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 0;
    font-size: 0.9rem;
    display: none;
}