/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --image-size: clamp(250px, 30vw + 1rem, 650px);
}

html {
    color-scheme: light;
}

body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    font-family: 'SF Pro Text', 'SF Pro Icons', 'AOS Icons', 'Helvetica Neue',
        Helvetica, Arial, sans-serif, system-ui;
    background: #fff;
    color: #000;
    overflow-x: hidden;
}

/* Header */
.main-header {
    position: fixed;
    top: 3rem;
    left: 3rem;
    z-index: 1000;
    text-align: left;
    pointer-events: none;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #000;
    opacity: 0.9;
    line-height: 1.4;
    margin-bottom: 1rem;
}

.site-description {
    font-size: 0.8rem;
    font-weight: 300;
    line-height: 1.6;
    color: #000;
    opacity: 0.7;
    max-width: 420px;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.about-link {
    font-size: 0.8rem;
    font-weight: 700;
    color: #000;
    opacity: 0.7;
    letter-spacing: 1px;
    text-decoration: none;
    transition: opacity 0.3s ease;
    display: block;
    cursor: pointer;
    pointer-events: auto;
}

.about-link:hover {
    opacity: 1;
}

/* About Page Content */
.about-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 4rem;
    min-height: 40vh;
}

@media (max-width: 768px) {
    .about-content {
        padding: 2rem;
    }
}

/* Main Content */
main {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 12vh;
}

.gallery-page main {
    margin-top: 16rem;
}

/* Gallery Carousel Styles */
.gallery-wrapper {
    position: relative;
    width: 100%;
}

.gallery {
    overflow-x: auto;
    overflow-y: hidden;
    width: 100vw;
    scroll-snap-type: x mandatory;
    padding-inline: calc(50vw - (var(--image-size) * 0.5));
    padding-block: 4rem;
    -webkit-overflow-scrolling: touch;
}

.gallery::-webkit-scrollbar {
    height: 6px;
}

.gallery::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
}

.gallery::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.gallery::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.06);
}

ul {
    display: flex;
    padding: 0;
    margin: 0;
    list-style: none;
    gap: 1rem;
}

li {
    scroll-snap-align: center;
    flex-shrink: 0;
}

figure {
    margin: 0;
    position: relative;
}

.gallery-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

img {
    aspect-ratio: 650 / 490;
    width: var(--image-size);
    object-fit: cover;
    display: block;
}

.gallery-link:hover img {
    filter: brightness(1.1);
}

/* Crop values for lens effect */
li:nth-of-type(1) { --crop: 35%; }
li:nth-of-type(2) { --crop: 0%; }
li:nth-of-type(3) { --crop: 10%; }
li:nth-of-type(4) { --crop: 16%; }
li:nth-of-type(5) { --crop: 20%; }
li:nth-of-type(6) { --crop: 24%; }
li:nth-of-type(7) { --crop: 30%; }

/* Scroll-driven animations */
@supports (animation-timeline: view()) {
    li {
        view-timeline-name: --item;
        view-timeline-axis: inline;
    }
    
    img {
        transform-origin: center;
        object-view-box: inset(var(--crop, 0) var(--crop, 0) var(--crop, 0) var(--crop, 0));
        animation: lens-effect linear;
        animation-timeline: view(inline);
        animation-range: cover 0% cover 100%;
    }
    
    @keyframes lens-effect {
        0%, 100% {
            scale: 0.7;
            opacity: 0.4;
        }
        50% {
            scale: 1;
            opacity: 1;
        }
    }
}

/* Fallback for browsers without animation-timeline support */
@supports not (animation-timeline: view()) {
    img {
        transition: transform 0.3s ease, opacity 0.3s ease;
    }
    
    li:hover img {
        transform: scale(1.05);
    }
}

/* About Page Styles */
.about-content {
    position: absolute;
    top: 8.5rem; /* Tight under the header */
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px; /* Narrower for better centering */
    padding: 0 2rem; /* Equal padding left and right */
    box-sizing: border-box;
    text-align: left; /* Keep text left-aligned within the centered block */
}

.about-photo {
    margin-bottom: 3rem;
}

.profile-image {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.about-text {
    max-width: 600px;
    margin-top: 2rem;
}

.about-text p {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #000;
    margin-bottom: 1.5rem;
    font-weight: 400;
}

@media (max-width: 768px) {
    .about-content {
        padding: 0 1rem; /* Equal padding for mobile */
        top: 6.5rem; /* Tight under mobile header */
        max-width: 90%; /* Responsive width on mobile */
    }
    
    .profile-image {
        width: 150px;
        height: 150px;
    }
}

/* Footer */
.main-footer {
    position: fixed;
    bottom: 2rem;
    left: 3rem;
    pointer-events: none;
    z-index: 100;
}

.footer-content {
    text-align: left;
    pointer-events: auto;
}

.main-footer p {
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: #000;
    font-weight: 300;
    opacity: 0.7;
}

.main-footer a {
    color: #000;
    text-decoration: none;
    transition: opacity 0.3s ease;
    font-weight: 700;
}

.main-footer a:hover {
    opacity: 1;
}

/* Gallery Page Styles */
.gallery-page {
    background: #fff;
    min-height: 100vh;
    padding-bottom: 6rem; /* Space for fixed footer */
}

.gallery-header {
    position: absolute;
    top: 8rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: left;
    z-index: 100;
    width: 100%;
    max-width: 1400px;
    padding-left: 4rem;
    box-sizing: border-box;
}

.gallery-title {
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    color: #000;
    opacity: 0.9;
    line-height: 1.4;
}

.gallery-date {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.6;
    color: #000;
    opacity: 0.7;
    letter-spacing: 0.3px;
}

.gallery-nav {
    position: fixed;
    top: 1.5rem;
    left: 3rem;
    z-index: 1000;
}

.back-link {
    color: #000;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 400;
    display: inline-block;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    line-height: 1;
}

.back-link:hover {
    opacity: 1;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem 4rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
    cursor: pointer;
    transition: transform 0.3s ease;
}

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

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

/* Gallery page footer - static at bottom */
.gallery-page .main-footer {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    padding: 0;
    background: none;
    pointer-events: none;
}

.gallery-page .footer-content {
    text-align: center;
    max-width: 1400px;
    margin: 0 auto;
    pointer-events: auto;
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 2000;
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-image {
    max-width: 98%;
    max-height: 98%;
    object-fit: contain;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover {
    transform: rotate(90deg);
    background: rgba(255, 255, 255, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --image-size: clamp(200px, 70vw, 350px);
    }
    
    .lightbox-image {
        max-width: 99%;
        max-height: 95%;
    }
    
    .main-header {
        top: 2rem;
        left: 2rem;
    }
    
    .site-title {
        font-size: 1.2rem;
    }
    
    .site-description {
        font-size: 0.75rem;
        max-width: 320px;
    }
    
    main {
        margin-top: 16vh;
    }
    
    .gallery {
        padding-block: 2rem;
    }
    
    .main-footer {
        bottom: 1.5rem;
        left: 2rem;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
        padding: 2rem 1rem 2rem;
    }
    
    .gallery-header {
        position: absolute;
        top: 6rem;
        left: 0;
        text-align: left;
        z-index: 100;
        width: 100%;
        padding-left: 1rem;
        box-sizing: border-box;
    }
    
    .gallery-page main {
        margin-top: 14rem;
    }
    
    .gallery-title {
        font-size: 1.2rem;
    }
    
    .gallery-nav {
        top: 1rem;
        left: 2rem;
    }
    
    .back-link {
        font-size: 0.9rem;
    }
    
    .gallery-page .main-footer {
        bottom: 1.5rem;
    }
}