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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
        Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    color: #111;
    background: #fff;
    line-height: 1.6;
}

a {
    color: #111;
    text-decoration: underline;
}

a:hover {
    color: #000;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

code {
    border: 1px solid rgba(29, 28, 29, .13);
    background-color: rgba(29, 28, 29, .04);
    color: rgb(192, 19, 67);
    font-variant-ligatures: none;
    white-space: pre;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: normal;
    tab-size: 4;
    border-radius: 3px;
    padding: 2px 3px 1px;
    font-size: 12px;
    line-height: 1.50001;
    font-family: Monaco, Menlo, Consolas, Courier New, monospace;
}

/* Nav */
nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-home {
    font-weight: 600;
    font-size: 1.1rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    font-size: 0.9rem;
    color: #555;
}

.nav-links a:hover {
    color: #111;
}

/* Main */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
}

/* Gallery grid (home page) — no-JS fallback */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.gallery-card img {
    width: 100%;
}

.gallery-card figcaption {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    text-align: center;
}

.gallery-card figcaption a {
    color: #333;
}

/* Home grid (large images, 2-col) */
.home-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
}

.home-grid-item {
    display: block;
    line-height: 0;
}

.home-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 600px) {
    .home-grid {
        grid-template-columns: 1fr;
    }
}

/* Gallery page */
.gallery-hero {
    margin-bottom: 1.5rem;
}

.gallery-hero img {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.gallery-hero figcaption {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #666;
    text-align: center;
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.gallery-description {
    color: #555;
    margin-bottom: 1.5rem;
}

/* Image grid (gallery page) — no-JS fallback */
.image-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.image-card img {
    width: 100%;
}

/* Masonry (applied by JS) */
.masonry {
    position: relative;
}

.masonry>* {
    position: absolute;
}

/* About / custom pages */
.about-content {
    max-width: 640px;
    margin: 0 auto;
    font-size: 1.125rem;
    line-height: 1.8;
    color: #333;
}

.about-content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #111;
}

.about-content p {
    margin-bottom: 1.5rem;
}

.about-content ul {
    margin: 0.5rem 0 1.5rem 1.5rem;
    list-style: disc;
}

.about-content li {
    margin-bottom: 0.4rem;
}

.about-content a {
    color: #333;
}

.about-content a:hover {
    color: #000;
}

/* Gallery navigation */
.gallery-nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem 0;
}

.gallery-series {
    margin-bottom: 2rem;
    text-align: center;
}

.gallery-series h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.series-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.series-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 140px;
    text-decoration: none;
}

.series-link img {
    width: 140px;
    height: 100px;
    object-fit: cover;
    border-radius: 2px;
}

.series-link span {
    margin-top: 0.4rem;
    font-size: 0.8rem;
    color: #555;
    text-align: center;
}

.series-link:hover span {
    color: #111;
}

.gallery-prevnext {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-top: 1px solid #eee;
    padding-top: 1.5rem;
}

.prevnext-link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    flex: 1;
}

.prevnext-prev {
    text-align: left;
}

.prevnext-next {
    text-align: right;
}

.prevnext-label {
    font-size: 0.8rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.prevnext-title {
    font-size: 0.95rem;
    color: #333;
    margin-top: 0.2rem;
}

.prevnext-link:hover .prevnext-title {
    color: #111;
    text-decoration: underline;
}

.prevnext-home {
    font-size: 0.85rem;
    color: #999;
    padding: 0 1rem;
    flex-shrink: 0;
}

.prevnext-home:hover {
    color: #111;
}

/* Footer */
footer {
    max-width: 1200px;
    margin: 2rem auto 0;
    padding: 1.5rem 1rem;
    border-top: 1px solid #eee;
    font-size: 0.85rem;
    color: #999;
    text-align: center;
}

footer a {
    color: inherit;
}

/* Responsive */
@media (max-width: 900px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .image-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .image-grid {
        grid-template-columns: 1fr;
    }

    nav {
        flex-direction: column;
        gap: 0.75rem;
    }

    .series-link {
        width: 100px;
    }

    .series-link img {
        width: 100px;
        height: 70px;
    }

    .prevnext-home {
        display: none;
    }
}