/* --- Global Styles & Fonts --- */
:root {
    --primary-font: "Georgia", serif;
    --secondary-font: "Helvetica Neue", "Arial", sans-serif;
    --background-color: #fdfdfd;
    --text-color: #333;
    --accent-color: #a2c4c9;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--secondary-font);
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-color);
}

/* --- Header --- */
header {
    text-align: center;
    padding: 2rem 1rem;
    background-color: #fff;
    border-bottom: 1px solid #eee;
}

header h1 {
    font-family: var(--primary-font);
    font-size: 2.5rem;
    margin: 0;
    color: var(--accent-color);
}

header p {
    margin: 0.5rem 0 0;
    font-size: 1rem;
    color: #777;
}

/* --- Main Layout --- */
.page-container {
    display: flex;
    flex-direction: column;
}

main {
    width: 100%;
    padding: 1rem;
    box-sizing: border-box;
}

section {
    padding-top: 4rem;
    margin-top: -4rem;
    /* Offset for anchor links */
}

section h2 {
    font-family: var(--primary-font);
    font-size: 2rem;
    text-align: center;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--accent-color);
    display: inline-block;
    padding-bottom: 0.5rem;
}

/* --- Side Navigation --- */
.side-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    transition: transform 0.3s ease-in-out;
    padding: 1rem;
    background-color: #f9f9f9;
    border-bottom: 1px solid #eee;
}

.side-nav.nav-hidden {
    transform: translateY(-100%);
}

.side-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.side-nav a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: bold;
    font-size: 1.5rem;
    padding: 0.5rem 0;
    transition: color 0.3s ease;
    border-bottom: 2px solid transparent;
}

.side-nav a:hover {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

/* --- Image Gallery --- */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.image-card {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 15px var(--shadow-color);
    cursor: pointer;
    aspect-ratio: 3 / 2;
}

.image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.image-card:hover img {
    transform: scale(1.05);
}

/* --- Download Button --- */
.download-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #333;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition:
        background-color 0.3s,
        transform 0.3s;
}

.download-btn:hover {
    background-color: #fff;
    transform: scale(1.1);
}

.download-btn svg {
    width: 24px;
    height: 24px;
    transition: transform 0.5s ease;
}

/* NEW: Style for download button when loading */
.download-btn.downloading {
    cursor: progress;
    background-color: #fff;
}

.download-btn.downloading svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* --- Lightbox (Modal) --- */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
    user-select: none;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 1001;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: #bbb;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    font-size: 2rem;
    padding: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    z-index: 1001;
}

.lightbox-nav:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.lightbox-nav.prev {
    left: 15px;
}

.lightbox-nav.next {
    right: 15px;
}

#lightbox-download {
    top: 15px;
    right: 10px;
}

/* --- Desktop Styles (min-width: 769px) --- */
@media (min-width: 769px) {
    .page-container {
        flex-direction: row;
    }

    .side-nav {
        position: sticky;
        top: 0;
        transform: none !important;
        height: 100vh;
        width: 200px;
        flex-shrink: 0;
        border-right: 1px solid #eee;
        border-bottom: none;
        padding: 4rem 1rem;
        box-sizing: border-box;
    }

    .side-nav ul {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    main {
        padding: 2rem 3rem;
    }

    section h2 {
        text-align: left;
    }
}