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

:root {
    --primary-color: #fff;
    --text-color: #fff;
    --bg-color: #000;
    --border-color: rgba(255, 255, 255, 0.2);
    --overlay: rgba(0, 0, 0, 0.9);
}

body {
    font-family: 'Courier New', monospace;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    font-weight: 300;
}

/* Navigation */
.navbar {
    background-color: rgba(0, 0, 0, 0.85);
    padding: 0.75rem 0;
    /* smaller header */
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    color: var(--text-color);
    font-size: 0.85rem;
    /* slightly smaller */
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: lowercase;
}

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

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.8rem;
    /* slightly smaller */
    font-weight: 300;
    letter-spacing: 0.5px;
    padding: 0.3rem 0;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
    border-bottom-color: var(--text-color);
}

/* Gallery Page */
.gallery-container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 2rem 1.25rem;
    /* tighter around the grid */
}

.gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    /* very small gaps for a "fabric" look */
}

.gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 4/3;
    background-color: rgba(0, 0, 0, 0.25);
    /* no tile background */
    border: none;
    /* remove borders around photos */
}

/* Small visual cue that an item has a stack */
.gallery-item.has-stack::after {
    content: "";
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 14px;
    height: 10px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6) inset,
        0 -2px 0 0 rgba(255, 255, 255, 0.6),
        0 -4px 0 0 rgba(255, 255, 255, 0.35);
    opacity: 0.9;
}

.gallery-item:hover {
    opacity: 0.7;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    /* fade-in base */
    transition: opacity 0.35s ease;
}

.gallery-item.loaded img {
    opacity: 1;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay);
    z-index: 1000;
    overflow: auto;
}

.lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    margin: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
}

/* Small stack arrows inside the lightbox (for sub-photos within a stack) */
.stack-btn {
    position: absolute;
    bottom: calc(4rem + 3rem + 10px);
    transform: translateX(-50%);
    background: transparent;
    color: #fff;
    border: 0;
    padding: 0;
    font-size: 1.2rem;
    cursor: pointer;
    display: none;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    /* shown only when a stack is active */
}

.lightbox.stack-has .stack-btn {
    display: flex;
}

.stack-btn.stack-prev {
    left: calc(50% - 60px);
}

.stack-btn.stack-next {
    left: calc(50% + 60px);
}

.stack-frame {
    position: relative;
}

.stack-peeks {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.stack-peeks img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.2s ease;
}

.stack-peeks .peek-prev {
    transform: translate(-16px, -16px);
    filter: brightness(0.3);
}

.stack-peeks .peek-next {
    transform: translate(-8px, -8px);
    filter: brightness(0.45);
}

.lightbox.stack-has #lightbox-img {
    box-shadow: -12px 12px 12px rgba(0, 0, 0, 0.35);
}

#lightbox-img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    position: relative;
    z-index: 1;
    background-color: var(--bg-color);
}

#lightbox-img.stack-swap {
    animation: swapIn 180ms ease;
    will-change: opacity;
    backface-visibility: hidden;
}

@keyframes swapIn {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

.metadata {
    background-color: transparent;
    padding: 2rem 3rem 2.5rem 3rem;
    width: 100%;
    max-width: 1000px;
    border-top: 1px solid var(--border-color);
}

.metadata-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2.5rem;
}

.metadata-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.metadata-item .label {
    font-weight: 400;
    color: #888;
    font-size: 0.75rem;
    text-transform: lowercase;
    letter-spacing: 0.5px;
}

.metadata-item .value {
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 300;
}

/* Lightbox Controls */
.close {
    position: absolute;
    top: 30px;
    right: 40px;
    color: var(--text-color);
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    z-index: 1001;
    transition: opacity 0.2s ease;
}

.close:hover {
    opacity: 0.5;
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: transparent;
    color: var(--text-color);
    border: none;
    font-size: 2rem;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.nav-btn:hover {
    opacity: 0.5;
}

.prev {
    left: 30px;
}

.next {
    right: 30px;
}

/* About Page */
.about-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 6rem 3rem;
}

.about-content {
    display: grid;
    grid-template-columns: 1.8fr 1.2fr;
    /* enlarge photo column */
    gap: 6rem;
    align-items: start;
}

.about-image img {
    width: 100%;
    display: block;
    border: 1px solid #666;
    opacity: 0;
    /* fade-in base */
    transition: opacity 0.35s ease;
}

.about-image img.is-loaded {
    opacity: 1;
}

/* Stack container expanded under a cover item */
.stack-container {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    padding: 8px 0 14px;
    animation: fadeIn 0.25s ease;
}

.stack-view {
    position: relative;
    width: min(1200px, 95%);
    aspect-ratio: 4 / 3;
    border: 1px solid rgba(255, 255, 255, 0.25);
    overflow: hidden;
}

.stack-view img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.stack-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    border: 0;
    padding: 8px 12px;
    cursor: pointer;
}

.stack-prev {
    left: 8px;
}

.stack-next {
    right: 8px;
}

.stack-swipe {
    animation: stackSwipe 180ms ease;
}

@keyframes stackSwipe {
    0% {
        transform: translateX(12px) rotate(0.3deg);
        opacity: 0.85;
    }

    100% {
        transform: translateX(0) rotate(0);
        opacity: 1;
    }
}

/* Loading state for gallery items */
.gallery-item.loading::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.04) 100%);
    animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.about-text h1 {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    color: var(--text-color);
    font-weight: 300;
    letter-spacing: 1px;
}

.about-text p {
    margin-bottom: 1.8rem;
    font-size: 1rem;
    line-height: 2;
    color: var(--text-color);
    font-weight: 300;
}

.contact-info {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 1px solid var(--border-color);
}

.contact-info h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-color);
    font-weight: 300;
    letter-spacing: 0.5px;
}

.contact-info p {
    margin-bottom: 1.5rem;
}

.contact-btn {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.8rem 2.5rem;
    background-color: transparent;
    color: var(--text-color);
    text-decoration: none;
    border: 1px solid var(--text-color);
    letter-spacing: 0.5px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.contact-btn:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
}

/* Softer blue links in About text */
.about-text a {
    color: #7fb3ff;
    text-decoration: underline;
}

.about-text a:hover {
    color: #a8c8ff;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 1.5rem;
    }

    .navbar {
        padding: 1.5rem 0;
    }

    .gallery {
        grid-template-columns: 1fr;
        gap: 1px;
        /* keep gaps minimal on mobile too */
    }

    .gallery-container {
        padding: 1.25rem 1rem;
    }

    .about-container {
        padding: 3rem 1.5rem;
    }

    .about-content {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .lightbox-content {
        margin: 1.5rem;
        gap: 1rem;
    }

    #lightbox-img {
        max-height: 50vh;
    }

    .metadata {
        padding: 2rem 1.5rem;
    }

    .metadata-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .nav-btn {
        display: none;
    }

    .stack-btn-container {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
        gap: 4rem;
        flex-wrap: nowrap;
    }

    .stack-btn {
        position: relative;
        bottom: auto;
        top: auto;
        left: auto;
        transform: none;
        margin: 0;
        display: flex;
        flex-shrink: 0;
    }

    .lightbox.stack-has .stack-btn {
        display: flex;
    }

    .stack-btn.stack-prev {
        left: auto;
    }

    .stack-btn.stack-next {
        left: auto;
    }

    .close {
        right: 20px;
        top: 20px;
        font-size: 1.5rem;
    }

    .nav-links {
        gap: 2rem;
    }

    .nav-links a {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .about-text h1 {
        font-size: 1.5rem;
    }

    .logo {
        font-size: 0.9rem;
        letter-spacing: 2px;
    }
}