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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: #1a1a1a;
    background: #fafafa;
}

header {
    padding: 1rem 2rem;
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
}

header nav a {
    color: inherit;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

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

h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.timespan {
    color: #666;
    margin-bottom: 1rem;
}

.description {
    margin-bottom: 1.5rem;
    max-width: 60ch;
}

/* Album listing grid */
.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.album-card {
    text-decoration: none;
    color: inherit;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s;
}

.album-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.album-card img {
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    display: block;
}

.album-placeholder {
    width: 100%;
    aspect-ratio: 3 / 2;
    background: #e0e0e0;
}

.album-info {
    padding: 0.75rem 1rem;
}

.album-info h2 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.album-info .timespan {
    font-size: 0.9rem;
    margin-bottom: 0;
}

/* Photo grid */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.photo-card {
    display: block;
}

.photo-card img {
    width: 100%;
    display: block;
    border-radius: 2px;
}

/* Photo page: full-viewport layout */
.photo-page header {
    display: none;
}

.photo-page main {
    max-width: none;
    padding: 0;
    height: 100vh;
}

.photo-page .photo-viewer {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #000;
    color: #fff;
}

.photo-topbar {
    padding: 0.75rem 1rem;
    flex-shrink: 0;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.photo-back {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9rem;
}

.photo-exif {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
}

.photo-exif-settings {
    margin-left: 0.5em;
}

.photo-back:hover {
    color: #fff;
}

.photo-stage {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
}

.photo-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    flex-shrink: 0;
    align-self: stretch;
    font-size: 2.5rem;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.5);
    transition: background 0.2s, color 0.2s;
    user-select: none;
}

.photo-nav:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.photo-nav-disabled {
    visibility: hidden;
}

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

.photo-main img {
    max-width: 100%;
    max-height: 100%;
    display: block;
    object-fit: contain;
}

@media (prefers-color-scheme: dark) {
    body {
        color: #e0e0e0;
        background: #121212;
    }

    header {
        background: #1a1a1a;
        border-bottom-color: #333;
    }

    .timespan {
        color: #999;
    }

    .album-card {
        background: #1a1a1a;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }

    .album-card:hover {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    }

    .album-placeholder {
        background: #333;
    }
}

@media (max-width: 600px) {
    main {
        padding: 1rem;
    }

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

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

    .photo-nav {
        width: 2.5rem;
        font-size: 1.5rem;
    }
}
