:root {
    --background: #f4f5f2;
    --surface: #ffffff;
    --surface-alt: #eef1ed;
    --text: #20251f;
    --muted: #667064;
    --border: #d9ded7;
    --accent: #346653;
    --accent-dark: #264d3e;
    --notice: #edf4ef;
    --notice-border: #b9cec0;

    --radius: 12px;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--background);
    color: var(--text);
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--background);
}

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

a {
    color: var(--accent-dark);
}

.container {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-top: 22px;
    padding-bottom: 22px;
}

.site-header h1 {
    margin: 0;
    font-size: clamp(1.7rem, 5vw, 2.4rem);
    line-height: 1;
}

.subtitle {
    margin: 6px 0 0;
    color: var(--muted);
}

.main-nav {
    display: flex;
    gap: 6px;
}

.main-nav a {
    padding: 9px 14px;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.main-nav a:hover,
.main-nav a.active {
    background: var(--accent);
    color: white;
}

.archive-notice {
    display: flex;
    gap: 7px;
    flex-direction: column;
    margin: 24px 0;
    padding: 15px 18px;
    background: var(--notice);
    border: 1px solid var(--notice-border);
    border-radius: var(--radius);
    color: #314a39;
}

.loading,
.error-message {
    margin: 40px 0;
    padding: 30px;
    text-align: center;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.error-message {
    color: #7b2222;
}

.day-toolbar {
    display: grid;
    grid-template-columns: 1fr minmax(220px, auto) 1fr;
    align-items: center;
    gap: 16px;
    margin: 28px 0 18px;
}

.day-toolbar > :last-child {
    justify-self: end;
}

.date-heading {
    text-align: center;
}

.date-heading h2 {
    margin: 0 0 9px;
    font-size: clamp(1.45rem, 4vw, 2rem);
}

.date-heading select {
    width: 100%;
    max-width: 230px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
}

.button {
    appearance: none;
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 10px 15px;
    background: var(--accent);
    color: white;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.button:hover:not(:disabled) {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
}

.button.secondary {
    background: var(--surface);
    color: var(--accent-dark);
}

.button.secondary:hover:not(:disabled) {
    background: var(--surface-alt);
}

.button.small {
    padding: 7px 12px;
    font-size: 0.9rem;
}

.button:disabled {
    opacity: 0.4;
    cursor: default;
}

.view-mode {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.picture-record {
    margin-bottom: 30px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.record-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
}

.record-title {
    margin: 0;
    font-size: 1.1rem;
    text-transform: capitalize;
}

.metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.metadata span {
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--surface-alt);
    color: var(--muted);
    font-size: 0.88rem;
}

.picture-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
    padding: 3px;
}

.picture-grid.single {
    grid-template-columns: 1fr;
}

.picture-grid a {
    display: block;
    min-width: 0;
}

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

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin: 28px 0 18px;
}

.section-heading h2 {
    margin: 0;
}

.section-heading p {
    margin: 5px 0 0;
    color: var(--muted);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.gallery-item {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.gallery-item a {
    color: inherit;
    text-decoration: none;
}

.gallery-image {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--surface-alt);
}

.gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 150ms ease;
}

.gallery-item:hover img {
    transform: scale(1.025);
}

.gallery-caption {
    padding: 11px 12px;
}

.gallery-date {
    font-weight: 700;
}

.gallery-meta {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.87rem;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin: 28px 0 44px;
}

.site-footer {
    margin-top: 50px;
    border-top: 1px solid var(--border);
    color: var(--muted);
}

.site-footer .container {
    padding-top: 22px;
    padding-bottom: 30px;
    font-size: 0.9rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 850px) {
    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 650px) {
    .container {
        width: min(100% - 20px, 1200px);
    }

    .site-header .container {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }

    .main-nav {
        width: 100%;
    }

    .main-nav a {
        flex: 1;
        text-align: center;
    }

    .day-toolbar {
        grid-template-columns: 1fr 1fr;
    }

    .date-heading {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .day-toolbar > :first-child {
        grid-column: 1;
        grid-row: 2;
    }

    .day-toolbar > :last-child {
        grid-column: 2;
        grid-row: 2;
        justify-self: stretch;
    }

    .day-toolbar .button {
        width: 100%;
    }

    .record-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 430px) {
    .gallery-grid {
        gap: 10px;
    }

    .gallery-caption {
        padding: 9px;
    }

    .pagination {
        gap: 8px;
    }
}
