:root {
    --bg: #0d1117;
    --panel: #161b22;
    --accent: #58a6ff;
    --text: #c9d1d9;
    --text-dim: #8b949e;
    --border: #30363d;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-y: scroll;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5%;
    border-bottom: 1px solid var(--border);
}

.logo { font-size: 1.5rem; font-weight: 600; cursor: default; }
.logo span { color: var(--accent); }

.header-right { position: relative; width: 300px; }
#categorySearch {
    width: 100%; background: #000; border: 1px solid var(--border);
    padding: 10px 15px; border-radius: 6px; color: white; outline: none;
}
.suggestions-box {
    position: absolute; top: 110%; left: 0; right: 0; background: var(--panel);
    border: 1px solid var(--border); border-radius: 6px; z-index: 100; display: none;
}
.suggestion-item { padding: 10px; cursor: pointer; border-bottom: 1px solid var(--border); }
.suggestion-item:hover { background: var(--accent); color: black; }

.navigation-bar {
    background: var(--panel);
    padding: 0 5%;
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-btn {
    background: transparent; color: var(--text-dim); border: none;
    padding: 15px 20px; cursor: pointer; font-size: 0.9rem;
    border-bottom: 2px solid transparent; transition: 0.2s;
    white-space: nowrap;
}

.nav-btn.active { color: #fff; border-bottom-color: var(--accent); }

/* 3x3 Grid - Optimized for 5:4 aspect ratio */
.gallery-container { padding: 40px 5%; min-height: 70vh; }
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.gallery-item {
    background: transparent; /* Removed black bars */
    aspect-ratio: 5 / 4; /* Optimized for your photo format */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

.gallery-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* Shows whole image */
    border-radius: 4px;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.overlay {
    position: absolute; 
    inset: 0; 
    background: rgba(0,0,0,0.2); 
    display: flex; 
    align-items: flex-end; 
    padding: 15px; 
    opacity: 0; 
    transition: 0.3s;
    border-radius: 4px;
}

.gallery-item:hover .overlay { opacity: 1; }
.gallery-item:hover img { transform: scale(1.03); }

.pill {
    background: rgba(0,0,0,0.8); color: white; border: 1px solid var(--border);
    padding: 6px 12px; border-radius: 4px; font-size: 11px; text-transform: uppercase;
    backdrop-filter: blur(4px);
}

/* Pagination */
.pagination-container {
    padding: 20px 5% 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.page-info { color: var(--text-dim); font-size: 0.8rem; }
.pagination-controls { display: flex; gap: 8px; }

.page-btn {
    background: var(--panel); color: var(--text); border: 1px solid var(--border);
    padding: 8px 14px; border-radius: 4px; cursor: pointer; transition: 0.2s;
}

.page-btn:hover:not(:disabled) { border-color: var(--accent); }
.page-btn.active { background: var(--accent); color: #000; font-weight: bold; }
.page-btn:disabled { opacity: 0.3; }

/* Modal Fixes */
.modal {
    display: none; position: fixed; z-index: 5000; inset: 0;
    background: rgba(5, 5, 5, 0.98); align-items: center; justify-content: center;
}
.modal-wrapper {
    position: relative; width: 90%; height: 90%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.modal-img { max-width: 100%; max-height: 85vh; object-fit: contain; box-shadow: 0 0 40px rgba(0,0,0,0.5); }
#modalCaption { margin-top: 15px; color: var(--accent); text-transform: uppercase; letter-spacing: 2px; font-size: 0.9rem; }
.close-modal { position: absolute; top: -40px; right: 0; color: #fff; font-size: 40px; cursor: pointer; }

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