* { box-sizing: border-box; }

body {
    margin: 0;
    background: #faf8f4;
    color: #2b2b2b;
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.7;
}

a { color: #7a5a3a; }

header, main, footer {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 32px;
}

/* Header and navigation */
header {
    padding-top: 64px;
    text-align: center;
}

.site-name {
    font-weight: normal;
    font-size: 44px;
    letter-spacing: 1px;
    margin: 0;
}

.site-name a {
    color: inherit;
    text-decoration: none;
}

nav {
    margin-top: 18px;
    display: flex;
    justify-content: center;
    gap: 36px;
}

nav a {
    color: #8a7f72;
    font-size: 14px;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-decoration: none;
    padding-bottom: 4px;
    border-bottom: 1px solid transparent;
    transition: color 0.2s;
}

nav a:hover { color: #2b2b2b; }

nav a.active {
    color: #2b2b2b;
    border-bottom-color: #2b2b2b;
}

main { padding-top: 56px; }

/* About and contact pages */
.prose {
    max-width: 720px;
    margin: 0 auto;
    font-size: 17px;
}

.prose h2, .contact h2 {
    font-weight: normal;
    font-size: 26px;
    margin: 0 0 20px;
}

.contact {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    font-size: 17px;
}

.contact .email {
    font-size: 20px;
    margin: 28px 0;
}

/* Gallery */
/* Row-by-row layout: each painting's width is proportional to its aspect
   ratio (--ar, set inline), so every painting in a row has the same height
   and nothing is cropped. The ::after spacer stops the last row stretching. */
.gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 28px 20px;
    align-items: flex-start;
}

.gallery::after {
    content: "";
    flex-grow: 999;
}

figure {
    margin: 0;
    flex-grow: var(--ar);
    flex-basis: calc(var(--ar) * 240px);
}

figure a {
    display: block;
    cursor: zoom-in;
}

figure img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 2px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    transition: opacity 0.2s;
}

figure a:hover img { opacity: 0.88; }

figcaption {
    font-size: 14px;
    font-style: italic;
    color: #6b6258;
    margin-top: 8px;
}

footer {
    text-align: center;
    color: #9a9087;
    font-size: 14px;
    padding-top: 56px;
    padding-bottom: 48px;
}

/* Lightbox */
dialog {
    border: none;
    padding: 0;
    background: transparent;
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    height: 100vh;
}

dialog::backdrop { background: rgba(20, 18, 16, 0.92); }

.lightbox {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 72px;
}

.lightbox img {
    max-width: 100%;
    max-height: calc(100vh - 110px);
    object-fit: contain;
}

.lightbox p {
    color: #e8e2da;
    font-style: italic;
    font-size: 15px;
    margin: 14px 0 0;
    min-height: 1.7em;
}

.lightbox button {
    position: fixed;
    background: none;
    border: none;
    color: #e8e2da;
    font-size: 40px;
    line-height: 1;
    cursor: pointer;
    padding: 12px 16px;
    opacity: 0.75;
}

.lightbox button:hover { opacity: 1; }
.lightbox .close { top: 12px; right: 12px; font-size: 34px; }
.lightbox .prev { left: 8px; top: 50%; transform: translateY(-50%); }
.lightbox .next { right: 8px; top: 50%; transform: translateY(-50%); }

@media (max-width: 600px) {
    header { padding-top: 40px; }
    .site-name { font-size: 34px; }
    nav { gap: 20px; }
    nav a { font-size: 12px; letter-spacing: 2px; }
    header, main, footer { padding-left: 20px; padding-right: 20px; }
    main { padding-top: 36px; }
    .prose, .contact { font-size: 16px; }
    .lightbox { padding: 16px 8px; }
    .lightbox .prev, .lightbox .next { top: auto; bottom: 8px; transform: none; }
}
