:root {
    --bg-color: #ffffff;
    --text-color: #1a1a1a;
    --text-light: #666666;
    --accent-color: #000000;
    --border-color: #eaeaea;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --container-width: 1200px;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
}

*, *::before, *::after {
    box-sizing: border_box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--text-light);
}

img {
    max-width: 100%;
    display: block;
    height: auto;
}

/* Layout */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Header */
.site-header {
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: 600;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

.site-nav ul {
    list-style: none;
    display: flex;
    gap: var(--spacing-md);
}

.site-nav a {
    font-size: 0.95rem;
    font-weight: 400;
}

.site-nav a:hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
}

/* Main Content */
main {
    min-height: 80vh;
    padding-bottom: var(--spacing-lg);
}

/* Hero */
.hero {
    padding: var(--spacing-lg) 0;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    letter-spacing: -0.03em;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-light);
    font-weight: 300;
}

/* Project Grid (Uniform) */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: var(--spacing-md);
}

.project-card {
    display: block;
    group: hover;
}

.project-card:hover .thumbnail-wrapper img {
    transform: scale(1.03);
}

.thumbnail-wrapper {
    width: 100%;
    aspect-ratio: 4/3; /* Enforce uniform aspect ratio */
    overflow: hidden;
    background-color: var(--border-color);
    border-radius: 4px;
    margin-bottom: var(--spacing-sm);
}

.thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.card-content h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.card-excerpt {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.5;
}

/* Project Page */
.project-header {
    padding: var(--spacing-lg) 0;
    max-width: 800px;
    margin: 0 auto;
}

.back-link {
    display: inline-block;
    margin-bottom: var(--spacing-md);
    font-size: 0.9rem;
    color: var(--text-light);
}

.project-header h1 {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-md);
}

.project-intro {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-color);
    text-align: left;
    max-width: 700px; /* Improve readability with optimal line length */
}
.project-intro p {
    margin-bottom: 1.5rem;
}
.project-intro a {
    text-decoration: underline;
    color: var(--accent-color);
}

/* Gallery Masonry */
.gallery-section {
    padding-top: var(--spacing-md);
}

.gallery-masonry {
    column-count: 3;
    column-gap: var(--spacing-md);
}

.gallery-item {
    break-inside: avoid;
    margin-bottom: var(--spacing-md);
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: 4px;
}

.gallery-item img {
    width: 100%;
    display: block;
    border-radius: 4px;
    transition: filter 0.3s ease;
}

.caption-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 1rem;
    font-size: 0.85rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    opacity: 0;
}

.gallery-item:hover .caption-overlay {
    transform: translateY(0);
    opacity: 1;
}

/* About Page */
.about-section {
    padding: var(--spacing-lg) 0;
    max-width: 800px;
    margin: 0 auto;
}

.about-image {
    margin-bottom: var(--spacing-md);
    border-radius: 4px;
    overflow: hidden;
}

.about-content {
    font-size: 1.1rem;
    line-height: 1.8;
}
.about-content p {
    margin-bottom: 1.5rem;
}

/* Footer */
.site-footer {
    padding: var(--spacing-lg) 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-light);
}

.social-links {
    margin-bottom: var(--spacing-sm);
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.social-links a {
    font-size: 1.25rem;
    color: var(--text-color);
    opacity: 0.7;
    transition: opacity 0.2s ease;
}
.social-links a:hover {
    opacity: 1;
}

/* Lightbox Modal */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.98);
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.lightbox-modal.active {
    display: flex;
}

.lightbox-image {
    max-width: 90%;
    max-height: 80vh;
    object-fit: contain;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.lightbox-caption {
    margin-top: 1rem;
    color: var(--text-color);
    font-size: 0.9rem;
    max-width: 80%;
    text-align: center;
}

.close-lightbox {
    position: absolute;
    top: 20px;
    right: 30px;
    color: var(--text-color);
    font-size: 40px;
    font-weight: 300;
    cursor: pointer;
    z-index: 1001;
}

.prev-slide, .next-slide {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -50px;
    color: var(--text-color);
    font-weight: bold;
    font-size: 20px;
    border-radius: 0 3px 3px 0;
    user-select: none;
    -webkit-user-select: none;
    transition: background-color 0.2s ease;
}

.next-slide {
    right: 20px;
    border-radius: 3px 0 0 3px;
}

.prev-slide {
    left: 20px;
    border-radius: 3px 0 0 3px;
}

.prev-slide:hover, .next-slide:hover {
    background-color: rgba(0,0,0,0.05);
}

/* Responsive */
@media (max-width: 768px) {
    .project-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }

    .gallery-masonry {
        column-count: 2;
    }

    .hero h1 {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .gallery-masonry {
        column-count: 1;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .site-nav ul {
        gap: var(--spacing-sm);
    }
}
/* Gallery Masonry - JS Controlled */
.gallery-section {
    padding-top: var(--spacing-md);
}

.gallery-masonry {
    display: flex;
    gap: var(--spacing-md);
    width: 100%;
}

.gallery-column {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    flex: 1;
    min-width: 0; /* Prevent flex items from overflowing */
}

.gallery-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: 4px;
    width: 100%;
}

.gallery-item img {
    width: 100%;
    display: block;
    border-radius: 4px;
    transition: filter 0.3s ease;
    height: auto;
}

/* Caption Overlay */
.caption-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 1rem;
    font-size: 0.85rem;
    transform: translateY(100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.gallery-item:hover .caption-overlay {
    transform: translateY(0);
    opacity: 1;
}

/* Mobile Captions & Layout */
@media (max-width: 768px) {
    .caption-overlay {
        position: static;
        transform: none;
        opacity: 1;
        background: transparent;
        color: var(--text-color);
        padding: 0.5rem 0 0 0;
        font-size: 0.9rem;
        font-style: italic;
    }

    /* Ensure gallery stacks nicely on very small screens,
       though JS handles column count, this is a fallback or override */
}
/* Video Container */
.video-section {
    padding: var(--spacing-md) 0;
    margin-bottom: var(--spacing-lg);
}

.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    max-width: 800px;
    margin: 0 auto;
    background: #000;
    border-radius: 4px;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
