/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --border-color: #e1e5e9;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.15);
    --accent: #007AFF;
    --accent-hover: #0056CC;
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --border-color: #3a3a3a;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.4);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.logo-link {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.logo-link:hover {
    color: var(--accent);
}

.logo-separator {
    color: var(--text-secondary);
    margin: 0 0.5rem;
}

.logo-section {
    color: var(--accent);
    font-weight: 600;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--bg-secondary);
}

.theme-icon {
    font-size: 1.2rem;
}

/* Main content */
.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Gallery grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    grid-auto-rows: 200px;
    gap: 1rem;
    margin-top: 1rem;
}

@media (min-width: 1200px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

.gallery-item {
    background: var(--bg-primary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border-color);
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    text-decoration: none;
    color: inherit;
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12px;
}

/* Tall image handling */
.gallery-item.tall {
    grid-row: span 2;
}

.gallery-item.extra-tall {
    grid-row: span 3;
}

/* Individual image page styles */
.image-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.image-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.full-image {
    max-width: 90vw;
    max-height: 75vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.image-info {
    width: 100%;
    max-width: 600px;
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-button {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.nav-button:hover:not(:disabled) {
    background: var(--bg-secondary);
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.logo-section-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.logo-section-link:hover {
    color: var(--accent-hover);
}

/* Modal styles - remove these as we're not using modals anymore */
/* Keeping metadata styles for individual pages */
.image-metadata h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 500;
}

.metadata-item {
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metadata-label {
    font-weight: 500;
    opacity: 0.8;
}

.metadata-value {
    text-align: right;
    max-width: 60%;
}

.image-description {
    margin-top: 1rem;
    opacity: 0.9;
    line-height: 1.5;
}

.metadata-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.metadata-compact-view .metadata-item {
    margin-bottom: 0;
    flex: 1;
}

.expand-btn,
.collapse-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.expand-btn:hover,
.collapse-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-1px);
}

.expand-icon {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.collapse-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem;
    min-width: 32px;
    justify-content: center;
}

/* Responsive design */
@media (max-width: 768px) {
    .main {
        padding: 1rem;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        grid-auto-rows: 150px;
        gap: 0.5rem;
    }
    
    .image-main {
        padding: 1rem;
        gap: 1rem;
    }
    
    .full-image {
        max-width: 95vw;
        max-height: 65vh;
    }
    
    .image-info {
        max-width: none;
    }
    
    .header-content {
        padding: 1rem;
    }
    
    .header-nav {
        gap: 0.25rem;
    }
    
    .nav-button {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .expand-btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.6rem;
    }
    
    .collapse-btn {
        font-size: 0.75rem;
        padding: 0.4rem;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        grid-auto-rows: 120px;
    }
}

/* Loading states */
.gallery-item.loading {
    opacity: 0.7;
    pointer-events: none;
}

.gallery-image.loading {
    background: var(--bg-secondary);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state h2 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.empty-state p {
    max-width: 400px;
    margin: 0 auto;
    line-height: 1.6;
}