:root {
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: 1px solid rgba(255, 255, 255, 0.3);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --text-main: #2c3e50;
    --transition-speed: 0.5s;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Libre Caslon Text', serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: var(--text-main);
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* Background Blobs for Glass Effect Visualization */
.blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(60px);
    z-index: -1;
    opacity: 0.6;
}
.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: #ff9a9e;
}
.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 40vw;
    height: 40vw;
    background: #a18cd1;
}

/* Glassmorphism Utility */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 20px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 3rem;
    margin: 2rem 3rem;
}

.logo {
    font-family: 'Libre Caslon Text', serif;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-decoration: none;
    color: var(--text-main);
}

nav a {
    text-decoration: none;
    color: var(--text-main);
    margin-left: 2rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
    transition: opacity 0.3s;
}
nav a:hover { opacity: 1; }

/* Main Layout */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 3rem 3rem 3rem;
    position: relative;
}

/* Accordion Gallery */
.accordion-container {
    display: flex;
    height: 60vh;
    width: 100%;
    padding: 1rem;
    gap: 0.5rem;
    overflow: hidden;
}

.accordion-item {
    flex: 1;
    background-size: cover;
    background-position: center;
    border-radius: 15px;
    cursor: pointer;
    transition: flex var(--transition-speed) ease, filter 0.3s;
    position: relative;
    overflow: hidden;
    filter: grayscale(100%);
    will-change: flex, filter;
    transform: translateZ(0);
}

.accordion-item:hover {
    flex: 4; /* Expand on hover */
    filter: grayscale(0%);
}

.item-content {
    position: absolute;
    bottom: 20px;
    left: 20px;
    color: white;
    font-family: 'Libre Caslon Text', serif;
    font-size: 1.5rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s 0.2s; /* Delay text appearance */
    text-shadow: 2px 2px 1px rgba(0, 0, 0, 0.712);
}

.accordion-item:hover .item-content {
    opacity: 1;
}

/* Project Detail View */
.project-view {
    width: 100%;
    padding: 0;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.close-btn {
    display: inline-block;
    margin-bottom: 1rem;
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-main);
    text-decoration: underline;
}

.gallery-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.scroll-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    color: var(--text-main);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.scroll-arrow:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.scroll-arrow.left { left: 1rem; }
.scroll-arrow.right { right: 1rem; }

.scrolling-gallery {
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    padding: 0 0 2rem 0;
    margin-top: 1rem;
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: rgba(44, 62, 80, 0.3) rgba(255, 255, 255, 0.1);
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
    user-select: none; /* Prevent text selection during drag */
}
.scrolling-gallery.active {
    cursor: grabbing;
    cursor: -webkit-grabbing;
    scroll-snap-type: none;
    scroll-behavior: auto;
}

.scrolling-gallery::-webkit-scrollbar { 
    display: block; 
    height: 8px;
}
.scrolling-gallery::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
.scrolling-gallery::-webkit-scrollbar-thumb {
    background: rgba(44, 62, 80, 0.3);
    border-radius: 4px;
}
.scrolling-gallery::-webkit-scrollbar-thumb:hover {
    background: rgba(44, 62, 80, 0.5);
}

.gallery-img {
    height: 25vh;
    width: auto;
    max-width: 90vw;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    scroll-snap-align: center;
    flex-shrink: 0;
    object-fit: cover;
}

.split-section {
    display: flex;
    margin-top: 4rem;
    gap: 4rem;
    align-items: center;
    padding-bottom: 4rem;
}

.split-left { flex: 1; }
.split-left img { width: 100%; border-radius: 15px; }
.split-right {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 2rem;
}
.split-right h2 { font-family: 'Libre Caslon Text', serif; font-weight: 700; font-size: 2.5rem; margin-bottom: 1rem; }
.split-right p { line-height: 1.6; color: #555; }

#contact-page .split-right p {
    font-size: 0.9rem;
}

.project-video {
    width: 100%;
    max-width: 250px;
    border-radius: 15px;
    margin-top: 1rem;
    margin-left: auto;
    margin-right: auto;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 5px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.close-lightbox {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: white;
    cursor: pointer;
    z-index: 1001;
}

.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    padding: 0 1rem;
    transition: background 0.3s;
    z-index: 1002;
    border-radius: 5px;
}

.lightbox-arrow:hover {
    background: rgba(255, 255, 255, 0.4);
}

.lightbox-arrow.left { left: 20px; }
.lightbox-arrow.right { right: 20px; }

@media (max-width: 768px) {
    /* Header */
    header {
        flex-direction: column;
        gap: 1.5rem;
        margin: 1rem;
        padding: 1.5rem;
    }

    nav {
        display: flex;
        justify-content: center;
        width: 100%;
    }

    nav a {
        margin: 0 1rem;
    }

    /* Main Layout */
    main {
        padding: 0 1rem 2rem 1rem;
    }

    /* Accordion Gallery on Homepage */
    .accordion-container {
        flex-direction: column;
        height: auto;
        gap: 1rem;
    }

    .accordion-item {
        width: 100%;
        height: 25vh; /* Adjust height for mobile */
        filter: grayscale(0%); /* Show colors on mobile */
        flex: none;
    }

    /* Disable the expand-on-hover effect */
    .accordion-item:hover {
        flex: none; /* Override the flex: 4 and ensure no change */
    }

    /* Make titles always visible on mobile */
    .item-content {
        opacity: 1;
        background: linear-gradient(to top, rgba(0,0,0,0.5), transparent);
        bottom: 0;
        left: 0;
        width: 100%;
        padding: 1rem;
        border-radius: 0 0 15px 15px;
    }

    /* Project Page Gallery */
    .scroll-arrow {
        display: none; /* Hide arrows on mobile, rely on swipe */
    }

    /* Split Section for Project and Contact pages */
    .split-section {
        flex-direction: column;
        gap: 2rem;
        margin-top: 2rem;
        padding: 2rem;
    }

    .split-right {
        flex-direction: column;
    }

    .project-video {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}