/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Josefin Sans', sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Josefin Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    background-color: #ffffff;
    color: #6b4fa0;
    font-size: 14px;
    line-height: 1.6;
}

/* Navigation */
.navbar {
    position: fixed;
    left: 0;
    top: 0;
    width: 140px;
    height: 100vh;
    background-color: #ffffff;
    border-right: none;
    z-index: 100;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.nav-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
}

.nav-logo {
    font-size: 18px;
    font-weight: 600;
    text-decoration: none;
    color: #20b2aa;
    letter-spacing: 0.8px;
    text-align: left;
    padding: 0;
    white-space: nowrap;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    align-items: flex-start;
}

.nav-link {
    text-decoration: none;
    color: #6b4fa0;
    font-size: 13px;
    font-weight: 400;
    transition: opacity 0.3s ease;
}

.nav-link:hover {
    opacity: 0.6;
}

/* Mobile menu toggle */
.menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 200;
    background: #ffffff;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: #6b4fa0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

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

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

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

/* Main content */
body {
    margin-left: 140px;
}

/* Main content */
/* Fixed site title shown at top of each page */
.top-title {
    position: fixed;
    top: 0;
    left: 140px;
    right: 0;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    background-color: #ffffff;
}

.top-title .top-logo {
    font-size: 18px;
    font-weight: 600;
    color: #20b2aa;
    letter-spacing: 0.8px;
    text-decoration: none;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: calc(3rem + 56px) 2rem 3rem;
}

/* Homepage */
.homepage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 140px);
    gap: 0;
}

.hero-image {
    width: 100%;
    max-width: 1100px;
}

.hero-image img {
    width: 100%;
    height: auto;
    display: block;
}

.hero-details {
    display: none;
}

/* Works page */
.works-container {
    display: none;
}

/* Gallery Section */
.gallery-section {
    max-width: 1100px;
    margin: 0 auto;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 140px);
    justify-content: center;
}

.gallery-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 2rem;
    color: #6b4fa0;
    letter-spacing: 0.5px;
    text-align: center;
}

/* Page-specific title colors */
.gallery-title.coordinates-title {
    color: #dbca67;
}

.gallery-title.portals-title {
    color: #9370DB;
}

.gallery-title.pigments-title {
    color: #4a7aaa;
}

.gallery-title.mediterranean-title {
    color: #20B2AA;
}

.gallery-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
}

.gallery-image {
    width: 100%;
    max-width: 900px;
    height: auto;
    display: block;
    border-radius: 2px;
    flex: 1;
    transition: opacity 0.2s ease-out;
}

.gallery-image.loading {
    opacity: 0.5;
}

.gallery-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: static;
    top: auto;
    left: auto;
    right: auto;
    transform: none;
    padding: 0;
    width: auto;
    flex-shrink: 0;
}

.gallery-button {
    background: none;
    border: none;
    color: #6b4fa0;
    font-size: 28px;
    cursor: pointer;
    transition: opacity 0.3s ease;
    padding: 1rem;
    pointer-events: all;
    opacity: 0.7;
}

.gallery-button:hover:not(:disabled) {
    opacity: 1;
}

.gallery-button:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

.gallery-counter {
    font-size: 13px;
    color: #6b4fa0;
    text-align: center;
    min-width: 80px;
    display: none;
}

.gallery-metadata {
    text-align: left;
    margin-top: 2rem;
    width: 100%;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.gallery-metadata p {
    font-size: 12px;
    color: #666;
    margin: 0.2rem 0;
}

/* About page */
.about-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.about-header {
    display: flex;
    gap: 3rem;
    margin-bottom: 3rem;
    align-items: flex-start;
}

.headshot {
    flex-shrink: 0;
    width: 200px;
}

.headshot img {
    width: 100%;
    height: auto;
    display: block;
}

.about-bio {
    flex: 1;
}

.about-bio h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 1.5rem;
    letter-spacing: 0.5px;
}

/* CV Section */
.cv-section {
    display: none;
}

.about-bio p {
    font-size: 13px;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    color: #333;
    text-align: justify;
}

.cv-note {
    font-size: 13px;
    font-style: italic;
    color: #666;
    margin-top: 1.5rem;
}

.cv-link {
    display: inline-block;
    font-size: 13px;
    color: #6b4fa0;
    text-decoration: underline;
    margin-top: 1rem;
    transition: opacity 0.3s ease;
}

.cv-link:hover {
    opacity: 0.6;
}

/* Contact page */
.contact-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 3rem 2rem;
    text-align: center;
}

.contact-container h1 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2rem;
    letter-spacing: 0.5px;
}

.contact-item {
    margin-bottom: 2rem;
}

.contact-item p {
    font-size: 13px;
    margin-bottom: 0.5rem;
}

.contact-link {
    font-size: 14px;
    color: #6b4fa0;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.contact-link:hover {
    opacity: 0.6;
}

.contact-link.email {
    text-decoration: underline;
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    border-top: none;
    font-size: 12px;
    color: #999;
    margin-top: 3rem;
}

/* Responsive design */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    .navbar {
        position: fixed;
        left: -200px;
        top: 0;
        width: 180px;
        transition: left 0.3s ease;
        box-shadow: none;
    }

    .navbar.open {
        left: 0;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    body {
        margin-left: 0;
    }

    .nav-container {
        padding-top: 3rem;
    }

    .nav-menu {
        gap: 0.8rem;
    }

    .about-header {
        flex-direction: column;
        gap: 1.5rem;
        align-items: center;
    }

    .headshot {
        width: 180px;
    }

    .about-bio {
        text-align: center;
    }

    .about-bio p {
        text-align: left;
    }

    .about-bio h2 {
        text-align: center;
    }

    .cv-note {
        text-align: center;
    }

    .works-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    main {
        padding: 2rem 1rem;
    }

    .gallery-section {
        padding: 2rem 1rem;
    }

    .gallery-container {
        flex-direction: column;
        gap: 1rem;
    }

    .gallery-controls {
        order: 2;
        width: 100%;
        justify-content: center;
        gap: 2rem;
    }

    .gallery-image {
        order: 1;
    }

    .gallery-metadata {
        order: 3;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .navbar {
        width: 160px;
        left: -160px;
    }

    .navbar.open {
        left: 0;
    }

    .nav-logo {
        font-size: 14px;
    }

    .nav-link {
        font-size: 12px;
    }

    .nav-menu {
        gap: 0.8rem;
    }

    body {
        font-size: 13px;
        margin-left: 0;
    }

    .work-title {
        font-size: 13px;
    }

    .about-container, .contact-container {
        padding: 1.5rem 1rem;
    }

    .about-header {
        gap: 1rem;
    }

    .headshot {
        width: 150px;
    }

    .about-bio p {
        font-size: 13px;
        line-height: 1.7;
    }

    .gallery-title {
        font-size: 16px;
    }

    .gallery-button {
        font-size: 24px;
        padding: 0.5rem;
    }

    .hero-image {
        max-width: 100%;
    }

    .homepage {
        min-height: calc(100vh - 100px);
        padding: 1rem;
    }
}

/* Ensure the fixed top title displays well on small and medium screens */
@media (max-width: 768px) {
    .top-title {
        left: 0;
        right: 0;
        height: 56px;
        justify-content: center;
    }

    .navbar {
        top: 56px;
        height: calc(100vh - 56px);
    }

    .menu-toggle {
        z-index: 260;
    }
}
