:root {
    --bg: #0d0d0d;
    --bg-elevated: #161616;
    --line: #2c2c2c;
    --text: #ededed;
    --text-muted: #9a9a9a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Oswald', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

.site-header {
    display: flex;
    align-items: baseline;
    gap: 1.5rem;
    padding: 1.5rem 2rem;
}

.site-header .back-link {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.site-header .back-link:hover { color: var(--text); }

.site-home-link {
    display: block;
    align-self: center;
    line-height: 0;
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

.site-home-link:hover { opacity: 1; }

.site-home-link img {
    display: block;
    width: 56px;
    height: auto;
}

.site-header h1 {
    font-size: 1.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 3px;
}

/* Gallery index grid */
.gallery-index {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 2px;
    padding: 2px;
    padding-left: 2rem;
    padding-right: 2rem;
}

.gallery-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-elevated);
}

.gallery-card-image {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #000;
}

.gallery-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease, filter 0.5s ease;
    filter: grayscale(15%);
}

.gallery-card:hover .gallery-card-image img {
    transform: scale(1.04);
    filter: grayscale(0%);
}

.gallery-card-info {
    padding: 1.1rem 1.2rem;
}

.gallery-card-info h2 {
    font-size: 1.15rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 0.4rem;
}

.gallery-card-info .count {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.empty-state {
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.gallery-content::after {
    content: "";
    display: table;
    clear: both;
}

/* Gallery description: floated so the thumbnails below can wrap around it */
.gallery-description {
    float: left;
    width: 520px;
    max-width: 55%;
    margin: 2rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.gallery-description p + p { margin-top: 1rem; }

/* Photo grid: plain block so its inline-block thumbnails wrap around the floated text */
.photo-grid {
    padding: 2rem;
}

.photo-thumb {
    display: inline-block;
    vertical-align: top;
    width: 170px;
    margin: 0 10px 10px 0;
    border: none;
    padding: 0;
    background: #000;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    cursor: pointer;
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.photo-thumb:hover img {
    transform: scale(1.05);
    opacity: 0.9;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.94);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem 0;
}

.lightbox[hidden] { display: none; }

.lightbox-main {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
}

.lightbox-image {
    max-width: 90vw;
    max-height: 100%;
    object-fit: contain;
}

.lightbox-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.5rem 1rem;
    opacity: 0.75;
    transition: opacity 0.2s ease;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.5rem 1rem;
    opacity: 0.75;
    transition: opacity 0.2s ease;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover { opacity: 1; }

.lightbox-prev { left: 0.5rem; }
.lightbox-next { right: 0.5rem; }

.lightbox-filmstrip {
    display: flex;
    gap: 8px;
    padding: 1rem 1rem 0;
    max-width: 100%;
    overflow-x: auto;
    flex: 0 0 auto;
}

.filmstrip-thumb {
    flex: 0 0 auto;
    width: 64px;
    height: 64px;
    border: 2px solid transparent;
    padding: 0;
    background: none;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s ease, border-color 0.2s ease;
}

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

.filmstrip-thumb:hover { opacity: 0.85; }
.filmstrip-thumb.active { opacity: 1; border-color: var(--text); }

body.lightbox-open { overflow: hidden; }

@media (max-width: 768px) {
    .site-header { padding: 1.2rem 1.2rem; gap: 1rem; }
    .site-header h1 { font-size: 1.2rem; letter-spacing: 2px; }
    .gallery-index { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); padding-left: 1.2rem; padding-right: 1.2rem; }

    /* Below the wrap-around breakpoint: stack description above a plain grid, no float */
    .gallery-content { display: flex; flex-direction: column; }
    .gallery-description { float: none; width: auto; max-width: none; margin: 0; padding: 1.2rem; order: 2; }
    .photo-grid {
        order: 1;
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 8px;
        padding: 1.2rem;
    }
    .photo-thumb { display: block; width: auto; margin: 0; }

    .lightbox-prev, .lightbox-next { font-size: 1.8rem; padding: 0.4rem 0.7rem; }
    .filmstrip-thumb { width: 48px; height: 48px; }
}

@media (max-width: 480px) {
    .gallery-index { grid-template-columns: 1fr 1fr 1fr; }
    .photo-grid { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
}
