/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #0d0d0d;
    --bg-card: #1a1a1a;
    --bg-nav: #111111ee;
    --text: #e0e0e0;
    --text-muted: #888;
    --accent: #6ea8fe;
    --accent-hover: #9ec5fe;
    --border: #2a2a2a;
    --radius: 8px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

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

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

/* === Navigation === */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-nav);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0 1rem;
}

.nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    height: 56px;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-inner::-webkit-scrollbar {
    display: none;
}

.site-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    flex-shrink: 0;
}

.site-title:hover {
    color: var(--accent);
}

.nav-categories {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 1;
}

.nav-categories::-webkit-scrollbar {
    display: none;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    white-space: nowrap;
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border);
    transition: all 0.15s ease;
}

.category-pill:hover {
    color: var(--text);
    border-color: var(--accent);
}

.category-pill .count {
    font-size: 0.7rem;
    opacity: 0.6;
}

.category-pill.tag {
    border-style: dashed;
}

/* === Page Header === */
.page-header {
    max-width: 1400px;
    margin: 2rem auto 1.5rem;
    padding: 0 1rem;
}

.page-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.page-header .description {
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.page-header .photo-count {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.category-type-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: var(--border);
    color: var(--text-muted);
    vertical-align: middle;
    margin-left: 0.5rem;
}

.category-type-badge.tag {
    border: 1px dashed var(--text-muted);
    background: transparent;
}

/* === Masonry Grid === */
.masonry {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
    position: relative;
}

.photo-card {
    position: absolute;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
}

.photo-card img {
    width: 100%;
    display: block;
    transition: transform 0.25s ease;
    cursor: pointer;
}

.photo-card:hover img {
    transform: scale(1.03);
}

.photo-card .photo-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2rem 0.75rem 0.5rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    font-size: 0.8rem;
    color: #fff;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.photo-card:hover .photo-title {
    opacity: 1;
}

/* === Category Grid === */
.category-grid {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: border-color 0.15s ease;
    display: block;
    color: var(--text);
    position: relative;
    overflow: hidden;
}

.category-card:hover {
    border-color: var(--accent);
    color: var(--text);
}

.category-card h2 {
    font-size: 1.15rem;
    margin-bottom: 0.25rem;
}

.category-card .count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.category-year {
    font-weight: 400;
    color: var(--text-muted);
}

.category-preview {
    margin-top: 0.75rem;
    border-radius: calc(var(--radius) - 4px);
    overflow: hidden;
    max-height: 180px;
}

.category-preview img {
    width: 100%;
    object-fit: cover;
}

/* === EXIF Table (legacy) === */
.exif-table {
    width: 100%;
    max-width: 500px;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.exif-table th,
.exif-table td {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.exif-table th {
    color: var(--text-muted);
    font-weight: 500;
    width: 130px;
}

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

.lightbox.active {
    display: flex;
}

.lightbox-image-wrap {
    position: relative;
    display: inline-block;
    max-width: 95vw;
    max-height: 85vh;
}

.lightbox-image {
    max-width: 95vw;
    max-height: 85vh;
    object-fit: contain;
    user-select: none;
    -webkit-user-select: none;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.lightbox-close:hover {
    opacity: 1;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #fff;
    font-size: 2.5rem;
    cursor: pointer;
    padding: 1rem;
    opacity: 0.5;
    transition: opacity 0.15s;
}

.lightbox-nav:hover {
    opacity: 1;
}

.lightbox-prev {
    left: 0.5rem;
}

.lightbox-next {
    right: 0.5rem;
}

.lightbox-counter {
    position: absolute;
    bottom: 1.5rem;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
}

.lightbox-title {
    position: absolute;
    bottom: 3rem;
    color: #fff;
    font-size: 1rem;
    text-align: center;
    max-width: 80vw;
}

.lightbox-info-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 2rem;
    height: 2rem;
    color: #fff;
    font-size: 1rem;
    font-style: italic;
    font-weight: 700;
    font-family: Georgia, "Times New Roman", serif;
    line-height: 2rem;
    text-align: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    cursor: pointer;
    transition: background 0.15s;
}

.lightbox-info-btn:hover {
    background: rgba(0, 0, 0, 0.6);
}

.lightbox-info-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}

/* === Lightbox Info Panel === */
.lightbox-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100%;
    background: rgba(20, 20, 20, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-left: 1px solid var(--border);
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.lightbox-panel.open {
    transform: translateX(0);
}

.lightbox-panel-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.lightbox-panel-close:hover {
    opacity: 1;
}

.lightbox-panel-content {
    padding: 1.5rem 1.25rem;
}

.panel-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #fff;
}

.panel-description {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.panel-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
}

.panel-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.exif-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.exif-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.85rem;
}

.exif-row dt {
    color: var(--text-muted);
    font-weight: 500;
}

.exif-row dd {
    color: var(--text);
    text-align: right;
}

/* === Responsive === */
@media (max-width: 768px) {
    .page-header h1 {
        font-size: 1.4rem;
    }

    .lightbox-nav {
        font-size: 1.8rem;
        padding: 0.5rem;
    }

    .lightbox-panel {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        max-height: 50vh;
        border-left: none;
        border-top: 1px solid var(--border);
        border-radius: 12px 12px 0 0;
        transform: translateY(100%);
    }

    .lightbox-panel.open {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .nav-inner {
        gap: 0.75rem;
    }

    .site-title {
        font-size: 1rem;
    }

    .masonry {
        padding-left: 0;
        padding-right: 0;
    }
}
