/* css/gallery-page.css — styles for individual static gallery piece pages */

/* ── Page layout ─────────────────────────────────────────────────────────── */

.gallery-page-body {
    background-color: #0a0a0a;
    color: #e8e8e8;
}

.gallery-page-body .main-nav {
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.gallery-page-body .site-footer {
    background: #0a0a0a;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.gallery-page-main {
    max-width: 900px;
    margin: 120px auto 80px auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */

.gallery-breadcrumb {
    margin-bottom: 32px;
}

.gallery-breadcrumb a {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.45);
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: color 0.2s;
}

.gallery-breadcrumb a:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* ── Hero image ──────────────────────────────────────────────────────────── */

.gallery-hero {
    margin-bottom: 40px;
    border-radius: 4px;
    overflow: hidden;
    background: #111;
}

.gallery-hero-img,
.gallery-hero-video {
    width: 100%;
    height: auto;
    max-height: 75vh;
    object-fit: contain;
    display: block;
    background: #111;
}

.gallery-hero-img.hidden-hero-img {
    display: none;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.gallery-header {
    margin-bottom: 48px;
    padding-bottom: 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.category-badge {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.06);
    padding: 5px 12px;
    border-radius: 3px;
    text-decoration: none;
    margin-bottom: 20px;
    transition: color 0.2s, background 0.2s;
}

.category-badge:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.1);
}

.piece-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 300;
    line-height: 1.15;
    color: #fff;
    margin-bottom: 16px;
    font-variant-ligatures: common-ligatures;
}

.piece-details {
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.6;
    margin-bottom: 16px;
    letter-spacing: 0.3px;
}

.piece-artist-line {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.35);
}

.piece-artist-line a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    transition: color 0.2s, border-color 0.2s;
}

.piece-artist-line a:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
}

/* ── Story section ───────────────────────────────────────────────────────── */

.gallery-story {
    margin-bottom: 56px;
}

.story-heading {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 24px;
    font-weight: 400;
}

.story-content {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.3rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.75);
}

.story-content p {
    margin-bottom: 1.5em;
}

.story-content p:first-of-type::first-letter {
    font-family: 'Cormorant Garamond', serif;
    font-size: 4.5rem;
    float: left;
    margin-top: -0.02em;
    margin-right: 0.06em;
    line-height: 0.82;
    font-weight: 300;
    font-style: italic;
    color: rgba(255, 255, 255, 0.9);
}

/* ── Split layout (story + tall image side by side) ─────────────────────── */

.gallery-split-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    margin-bottom: 56px;
}

.split-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.split-text .gallery-grid-section {
    margin-bottom: 0;
    margin-top: auto;
}

.split-text .gallery-story {
    margin-bottom: 0;
}

.split-tall-img {
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    background: #111;
    max-height: 80vh;
}

.split-tall-img .grid-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Image grid ──────────────────────────────────────────────────────────── */

.gallery-grid-section {
    margin-bottom: 56px;
}

.grid-heading {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 24px;
    font-weight: 400;
}

.gallery-image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.grid-item {
    border-radius: 4px;
    overflow: hidden;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    max-height: 85vh;
}

/* Tall images (portrait > 2:1) — narrow, full-height, centered.
   Inline aspect-ratio from the JS sets the exact width-to-height ratio
   so with height: 85vh the container stays naturally narrow. */
.grid-item-tall {
    grid-column: 1 / -1;
    justify-self: center;
    height: 85vh;
    overflow: hidden;
}

.grid-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.4s ease, opacity 0.3s;
    cursor: pointer;
}

/* Tall images: fill the container, let aspect-ratio handle width */
.grid-item-tall .grid-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Regular aspect images (near-square or landscape) use cover for a tighter crop */
.grid-item:not(.grid-item-tall) .grid-img {
    aspect-ratio: 1;
    object-fit: cover;
}

.grid-img:hover {
    transform: scale(1.03);
    opacity: 0.9;
}

/* ── Piece navigation (prev/next) ────────────────────────────────────────── */

.piece-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin: 48px 0;
    padding: 32px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.piece-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    transition: color 0.2s;
    max-width: 45%;
}

.piece-nav-link:hover {
    color: #fff;
}

.piece-nav-link svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.piece-nav-link:hover svg {
    opacity: 1;
}

.piece-nav-next {
    margin-left: auto;
    text-align: right;
}

.piece-nav-link span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Related pieces ──────────────────────────────────────────────────────── */

.related-pieces {
    margin: 56px 0;
}

.related-heading {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 24px;
    font-weight: 400;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.related-card {
    text-decoration: none;
    color: inherit;
    border-radius: 4px;
    overflow: hidden;
    background: #111;
    transition: transform 0.3s ease;
}

.related-card:hover {
    transform: translateY(-4px);
}

.related-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s;
}

.related-card:hover img {
    opacity: 0.85;
}

.related-title {
    display: block;
    padding: 12px 10px;
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    letter-spacing: 0.3px;
}

/* ── Footer nav ──────────────────────────────────────────────────────────── */

.gallery-footer-nav {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.gallery-nav-link {
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: color 0.2s;
}

.gallery-nav-link:hover {
    color: #fff;
}

/* ── Lightbox ────────────────────────────────────────────────────────────── */

.gallery-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(5, 5, 5, 0.97);
    align-items: center;
    justify-content: center;
    padding: 2rem;
    cursor: zoom-out;
}

.gallery-lightbox.active {
    display: flex;
}

.gallery-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    cursor: default;
}

.lb-close {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    color: rgba(255, 255, 255, 0.5);
    z-index: 1001;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    transition: color 0.3s, transform 0.3s;
}

.lb-close:hover {
    color: #fff;
    transform: rotate(90deg);
}

.lb-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
    z-index: 1001;
    background: none;
    border: none;
    padding: 1rem;
    cursor: pointer;
    transition: color 0.3s;
}

.lb-arrow:hover {
    color: #fff;
}

.lb-prev {
    left: 1rem;
}

.lb-next {
    right: 1rem;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 700px) {
    .gallery-page-main {
        margin-top: 90px;
        padding: 0 16px;
    }

    .piece-title {
        font-size: 2rem;
    }

    .gallery-split-layout {
        flex-direction: column;
        gap: 24px;
    }

    .split-tall-img {
        max-height: 70vh;
        align-self: center;
    }

    .gallery-image-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .grid-item {
        min-height: auto;
        max-height: 60vh;
    }

    /* Tall images still get full height on mobile */
    .grid-item-tall {
        max-height: 85vh;
    }

    .grid-item:not(.grid-item-tall) .grid-img {
        aspect-ratio: auto;
        object-fit: contain;
    }

    .related-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .related-grid .related-card:nth-child(3) {
        display: none;
    }

    .story-content {
        font-size: 1.15rem;
    }

    .story-content p:first-of-type::first-letter {
        font-size: 3.5rem;
    }

    .piece-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .piece-nav-link {
        max-width: 100%;
    }

    .piece-nav-next {
        margin-left: 0;
        justify-content: flex-end;
    }
}

@media (max-width: 400px) {
    .gallery-hero-img,
    .gallery-hero-video {
        max-height: 60vh;
    }
}
