:root {
    --bg-color: #fafafa;
    --text-color: #111111;
    --text-muted: #666666;
    --accent-color: #000000;
    --nav-bg: rgba(250, 250, 250, 0.9);
    --border-color: rgba(0, 0, 0, 0.1);
    --card-bg: #ffffff;
    --font-sans: 'Inter', sans-serif;
    --font-serif: 'Playfair Display', serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #111111;
        --text-color: #eeeeee;
        --text-muted: #aaaaaa;
        --accent-color: #ffffff;
        --nav-bg: rgba(17, 17, 17, 0.9);
        --border-color: rgba(255, 255, 255, 0.1);
        --card-bg: #1c1c1c;
    }
    
    .gallery-item {
        background-color: var(--card-bg) !important;
        border-color: var(--border-color) !important;
    }

    /* Keep footer dark in dark mode or invert?
       Currently footer is bg: text-color (#eee) -> light footer in dark mode?
       If text-color is #eee, footer bg becomes #eee (light grey). Text becomes #111 (dark).
       This creates a "Light" footer in Dark mode. That's a valid style choice (contrast).
       Let's stick with it for now.
    */
}

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.loader-content {
    text-align: center;
}

.loader-logo {
    font-family: var(--font-serif);
    font-size: 2rem;
    color: var(--text-color);
    margin-bottom: 20px;
    opacity: 0;
    animation: fadeUp 0.8s ease-out forwards;
}

.loader-line {
    width: 0;
    height: 2px;
    background-color: var(--text-color);
    margin: 0 auto;
    animation: lineGrow 1.5s ease-in-out forwards 0.5s;
}

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

@keyframes lineGrow {
    to { width: 100px; }
}

body.loaded #preloader {
    opacity: 0;
    visibility: hidden;
}

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

html {
    scroll-behavior: smooth;
}

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

/* Typography */
h1, h2, h3, .logo {
    font-family: var(--font-serif);
    font-weight: 400;
}

a {
    color: var(--text-color);
    text-decoration: none;
    transition: opacity 0.3s ease;
}

a:hover {
    opacity: 0.6;
}

/* Navigation */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 4rem;
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--nav-bg); /* Updated */
    backdrop-filter: blur(10px);
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 1000;
    position: relative;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 2px;
    background-color: var(--text-color);
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: #000;
    position: relative;
    overflow: hidden;
}

/* Film Reel Marquee */
.marquee-container {
    position: absolute;
    width: 100%;
    height: 100vh;
    top: 0;
    left: 0;
    overflow: hidden;
    z-index: 0;
    opacity: 0.3; /* Adjusted opacity so text is readable */
    display: flex;
    align-items: center; /* Center strip vertically */
}

/* Diagonal or Horizontal Marquee Track */
.marquee-track {
    display: flex;
    gap: 2rem;
    width: max-content;
    will-change: transform; /* Hint browser to optimize */
    animation: marquee 60s linear infinite; /* Slower and smoother */
    transform: translate3d(0, 0, 0); /* Force GPU acceleration */
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.marquee-item {
    height: 50vh; 
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    /* Improve performance for items inside */
    transform: translateZ(0);
}

.marquee-item img {
    height: 100%;
    width: auto;
    display: block;
    object-fit: cover;
    /* Ensure image decoding doesn't block main thread */
    content-visibility: auto; 
}

/* Hero Content */
.hero-content {
    position: relative;
    z-index: 10;
    background: rgba(0,0,0,0.4); /* Optional: ensures text legibility */
    padding: 2rem;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

.hero h1 {
    font-size: clamp(4rem, 10vw, 8rem);
    margin-bottom: 1rem;
    letter-spacing: -3px;
    line-height: 1;
    color: #ffffff;
    text-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.hero .subtitle {
    font-size: 1.5rem;
    color: #e0e0e0;
    font-weight: 400;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

/* Portfolio Gallery */
.portfolio-section {
    padding: 6rem 4rem;
    max-width: 1600px;
    margin: 0 auto;
}

/* Filter Buttons */
.filter-container {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 4rem;
    flex-wrap: wrap;
}

.filter-btn {
    background: transparent;
    border: 1px solid #ccc;
    padding: 0.8rem 1.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-sans);
    color: var(--text-color);
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--text-color);
    color: var(--bg-color);
    border-color: var(--text-color);
}

.gallery-grid {
    column-count: 3;
    column-gap: 2rem;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background-color: var(--card-bg); /* updated */
    break-inside: avoid;
    margin-bottom: 2rem;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15), 0 4px 10px rgba(0, 0, 0, 0.05);
    transform: translateY(40px);
    opacity: 0;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.8s ease, box-shadow 0.4s ease;
    border: 1px solid var(--border-color); /* updated */
}

.gallery-item.visible {
    transform: translateY(0);
    opacity: 1;
}

.gallery-item img {
    width: 100%;
    display: block;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-item:hover {
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25), 0 10px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(-5px);
}

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

.item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.2) 50%, rgba(0, 0, 0, 0) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 2.5rem;
    opacity: 0;
    transition: opacity 0.4s ease;
}

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

.item-category {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 0.8rem;
    color: #ddd;
    transform: translateY(10px);
    transition: transform 0.4s ease;
}

.item-title {
    font-size: 1.8rem;
    font-family: var(--font-serif);
    transform: translateY(10px);
    transition: transform 0.4s ease 0.05s;
}

.gallery-item:hover .item-category,
.gallery-item:hover .item-title {
    transform: translateY(0);
}

/* About Section */
.about-section {
    padding: 10rem 4rem;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
    background-color: #111;
    color: #fff;
    border-radius: 20px;
    margin-bottom: 8rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.about-section h2 {
    font-size: 3rem;
    margin-bottom: 2rem;
    color: #fff;
}

.about-section p {
    font-size: 1.8rem;
    color: #ccc;
    line-height: 1.5;
    font-family: var(--font-serif);
    font-style: italic;
}

/* Footer / Contact */
footer {
    padding: 10rem 4rem 6rem;
    text-align: center;
    background-color: var(--text-color);
    color: var(--bg-color);
    position: relative;
    overflow: hidden;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.2), transparent);
}

footer h2 {
    font-size: clamp(3rem, 6vw, 5rem);
    margin-bottom: 3rem;
    letter-spacing: -1px;
}

.contact-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 4rem;
}

.contact-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    max-width: 400px;
    padding: 1.2rem 2rem;
    font-size: 1.2rem;
    font-weight: 500;
    border-radius: 50px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.messenger-btn {
    background-color: #0084FF;
    color: white;
    border: 2px solid #0084FF;
}

.messenger-btn:hover {
    background-color: transparent;
    color: #0084FF;
    opacity: 1;
}

.instagram-btn {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: white;
    border: none;
    position: relative;
}

.instagram-btn::before {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: -1;
    margin: -2px;
    border-radius: inherit;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

.instagram-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(188, 24, 136, 0.4);
    opacity: 1;
    filter: brightness(1.1);
}

.copyright {
    font-size: 0.8rem;
    color: #888;
}

/* Lightbox */
.lightbox {
    display: none; /* Changed via JS to flex */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.98);
    backdrop-filter: blur(10px);
    overflow-y: auto; /* Allow scrolling if content is tall */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.lightbox-content {
    max-width: 100%;
    max-height: 70vh; /* Leave room for caption */
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    margin-bottom: 2rem;
    animation: zoom 0.3s ease;
}

#lightbox-caption {
    width: 100%;
    max-width: 600px;
    text-align: center;
    color: #fff;
    font-family: var(--font-serif);
}

.lightbox-cta {
    display: inline-flex;
    align-items: center;
    background: #fff;
    color: #000;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-family: var(--font-sans);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-top: 1rem;
}

.lightbox-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(255,255,255,0.2);
    opacity: 1;
    text-decoration: none;
    color: #000;
}

.close-lightbox {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: 300;
    cursor: pointer;
    z-index: 1001;
    line-height: 1;
}

@keyframes zoom {
    from {transform:scale(0.9); opacity:0}
    to {transform:scale(1); opacity:1}
}

/* Responsive */
@media (max-width: 1024px) {
    .gallery-grid {
        column-count: 2;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 1.5rem 2rem;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        width: 70%;
        max-width: 300px;
        background: var(--bg-color);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2rem;
        transition: right 0.3s ease;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
        padding: 2rem;
        z-index: 999;
    }
    
    .nav-links.active {
        right: 0;
    }
    
    .nav-links li {
        width: 100%;
        text-align: center;
    }
    
    .nav-links a {
        display: block;
        padding: 1rem;
        font-size: 1.1rem;
    }
    
    .portfolio-section {
        padding: 4rem 2rem;
    }
    .gallery-grid {
        column-count: 1;
    }
    .hero h1 {
        font-size: 3rem;
    }
    
    /* Mobile Marquee Speedup */
    .marquee-track {
        animation-duration: 20s;
    }
    
    /* Mobile Filter Buttons */
    .filter-container {
        gap: 0.75rem;
        margin-bottom: 3rem;
    }
    
    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
        letter-spacing: 1px;
    }
}