/* Sidebar Gallery Filters */
.sidebar .gallery-filters {
    margin-bottom: auto;
}

/* Hide filter UI elements (keep JS logic intact) */
.gallery-filters,
.mobile-filters {
    display: none !important;
}

/* Filter Toggle Button */
.filter-toggle-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid transparent;
    background-color: transparent;
    color: var(--text-color);
    font-family: 'Futura PT', 'Avenir Next', 'Helvetica Neue', Arial, sans-serif;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: left;
    letter-spacing: 0.02em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.filter-toggle-btn:hover {
    color: var(--white);
    background-color: #000000;
    border: 2px solid #000000;
    transform: translateX(4px);
}

.filter-toggle-btn .chevron {
    transition: transform 0.3s ease;
    font-size: 0.8rem;
}

.filter-toggle-btn.expanded .chevron {
    transform: rotate(180deg);
}

.sidebar .filter-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar .filter-buttons.expanded {
    max-height: 500px;
}

/* Sidebar Filter Buttons */
.sidebar .filter-btn {
    padding: 0.75rem 1rem;
    border: 2px solid transparent;
    background-color: transparent;
    color: var(--text-color);
    font-family: 'Futura PT', 'Avenir Next', 'Helvetica Neue', Arial, sans-serif;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
    letter-spacing: 0.02em;
}

.sidebar .filter-btn:hover {
    color: var(--white);
    background-color: #000000;
    border: 2px solid #000000;
    transform: translateX(4px);
}

.sidebar .filter-btn.active {
    background-color: #333333;
    color: var(--white);
    border: 2px solid #333333;
}

/* Gallery Grid - True Masonry Style */
.gallery-grid,
.album-grid {
    position: relative;
    padding: 0;
    width: 100%;
    /* Height will be set by JavaScript masonry layout */
    min-height: 200px; /* Ensure some height for layout */
}

/* Fallback grid in case JavaScript doesn't load */
.gallery-grid:not(.masonry-initialized),
.album-grid:not(.masonry-initialized) {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-gap: 0.75rem;
}

/* DSi-specific grid layout for DSi Early Work album */
.album-grid.dsi-grid-layout {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    grid-gap: 1rem;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    height: auto !important; /* Override masonry height calculations */
}

.album-grid.dsi-grid-layout .gallery-item {
    position: static !important;
    width: 100% !important;
    left: auto !important;
    top: auto !important;
    max-width: 250px;
    margin: 0 auto;
}

.album-grid.dsi-grid-layout .gallery-item img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

/* DSi photo styling */
.dsi-photo {
    border: 2px solid #333;
    border-radius: 2px;
    background: #f5f5f5;
}

.dsi-photo:hover {
    border-color: #666;
    transform: scale(1.02);
}

/* Mobile responsive for DSi grid */
@media (max-width: 768px) {
    .album-grid.dsi-grid-layout {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        grid-gap: 0.75rem;
        padding: 0.75rem;
    }

    .album-grid.dsi-grid-layout .gallery-item {
        max-width: 200px;
    }
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 0;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.5s ease;
    background-color: var(--white);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    opacity: 0;
    transform: translateY(20px);
    /* Grid item will be positioned by JavaScript */
}

.gallery-item.loaded {
    opacity: 1;
    transform: translateY(0);
}

/* Prevent cramming during initial load */
.gallery-grid:not(.masonry-initialized) .gallery-item {
    opacity: 1;
    transform: translateY(0);
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.gallery-item img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
    border-radius: 0;
}

.gallery-item-info {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0,0,0,0.8);
    color: #ffffff;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-size: 0.8rem;
    line-height: 1.2;
    max-width: calc(100% - 16px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.gallery-item-info h3 {
    font-size: 0.85rem;
    font-weight: 500;
    margin: 0 0 0.25rem 0;
    color: #ffffff;
}

.gallery-item-info p,
.gallery-item-info .image-date {
    font-size: 0.75rem;
    margin: 0;
    color: rgba(255,255,255,0.9);
    font-weight: 400;
}

.gallery-item:hover .gallery-item-info {
    opacity: 1;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    z-index: 2000;
}

.lightbox.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-img {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
}

.lightbox .close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: var(--white);
    font-size: 2rem;
    cursor: pointer;
}

.lightbox .prev,
.lightbox .next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    color: var(--white);
    font-size: 2rem;
    padding: 1rem;
    cursor: pointer;
}

.lightbox .prev { left: 20px; }
.lightbox .next { right: 20px; }

.lightbox-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--white);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 1001;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid var(--white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.image-info {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    color: var(--white);
    padding: 1rem;
    background: rgba(0,0,0,0.8);
    border-radius: 4px;
    backdrop-filter: blur(10px);
}

.image-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--white);
    text-align: center;
}

.image-info .exif-data {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.image-info .exif-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    min-width: 80px;
}

.image-info .exif-label {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.7);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.image-info .exif-value {
    font-size: 0.85rem;
    color: var(--white);
    font-weight: 400;
    text-align: center;
}

.image-info .image-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

.image-info .tag {
    background: rgba(255,255,255,0.2);
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--white);
    font-weight: 500;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .image-info {
        bottom: 10px;
        left: 10px;
        right: 10px;
        padding: 0.75rem;
    }

    .image-info .exif-data {
        gap: 1rem;
    }

    .image-info .exif-item {
        min-width: 60px;
    }
}

/* Album Specific Styles */
.breadcrumb {
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.breadcrumb ol {
    list-style: none;
    display: flex;
    gap: 0.5rem;
}

.breadcrumb li:not(:last-child):after {
    content: "/";
    margin-left: 0.5rem;
    color: var(--medium-gray);
}

.album-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.album-actions {
    margin-top: 1rem;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Albums Timeline */
.albums-timeline {
    margin-top: 2rem;
    margin-bottom: auto;
}

.albums-timeline h3 {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    font-family: 'Futura PT', 'Avenir Next', 'Helvetica Neue', Arial, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.timeline-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Year Group Styles */
.timeline-year-group {
    margin-bottom: 0.25rem;
}

.timeline-year-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: 'Futura PT', 'Avenir Next', 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
    text-align: left;
    transition: all 0.3s ease;
}

.timeline-year-header:hover {
    background-color: var(--light-gray);
}

.timeline-year-arrow {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
    color: var(--medium-gray);
}

.timeline-year-header.expanded .timeline-year-arrow {
    transform: rotate(90deg);
}

.timeline-year-label {
    flex: 1;
}

.timeline-year-count {
    font-size: 0.7rem;
    color: var(--medium-gray);
    font-weight: 500;
    background: var(--light-gray);
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
}

.timeline-year-albums {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding-left: 0.75rem;
}

.timeline-year-albums.expanded {
    max-height: 1000px;
}

/* Timeline Item Styles (compact) */
.timeline-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: 0;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    font-family: 'Futura PT', 'Avenir Next', 'Helvetica Neue', Arial, sans-serif;
    border: 1px solid transparent;
}

.timeline-item:hover {
    background-color: #000000;
    color: var(--white);
    transform: translateX(4px);
}

.timeline-item:hover .timeline-date,
.timeline-item:hover .timeline-title,
.timeline-item:hover .timeline-count {
    color: var(--white);
}

.timeline-date {
    font-size: 0.7rem;
    color: var(--medium-gray);
    font-weight: 500;
    min-width: 32px;
    text-align: right;
}

.timeline-details {
    flex: 1;
    min-width: 0;
}

.timeline-title {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-meta {
    display: none;
}

.timeline-count {
    font-size: 0.65rem;
    color: var(--medium-gray);
    font-weight: 500;
    flex-shrink: 0;
}

/* Load More Button */
.load-more-btn {
    display: block;
    margin: 3rem auto 2rem;
    padding: 1rem 2rem;
    background-color: var(--secondary-color);
    border: none;
    color: var(--white);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 1rem;
}

.load-more-btn:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Loading Indicator for Infinite Scroll */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    margin: 2rem auto;
    text-align: center;
}

.loading-indicator .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--light-gray);
    border-top: 4px solid var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading-indicator p {
    color: var(--medium-gray);
    font-size: 1rem;
    margin: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Skeleton Loading States */
.skeleton-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-gap: 0.75rem;
    padding: 1rem;
}

.skeleton-item {
    background-color: var(--light-gray);
    border-radius: 0;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.skeleton-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255,255,255,0.4),
        transparent
    );
    animation: skeleton-shimmer 1.5s infinite;
}

.skeleton-image {
    width: 100%;
    height: 200px;
    background-color: #f0f0f0;
}

.skeleton-image.tall {
    height: 300px;
}

.skeleton-image.landscape {
    height: 160px;
}

@keyframes skeleton-shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Timeline Skeleton */
.timeline-skeleton {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.timeline-skeleton-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
}

.timeline-skeleton-date {
    width: 60px;
    height: 12px;
    background-color: var(--light-gray);
    border-radius: 2px;
}

.timeline-skeleton-content {
    flex: 1;
}

.timeline-skeleton-title {
    width: 120px;
    height: 14px;
    background-color: var(--light-gray);
    border-radius: 2px;
    margin-bottom: 0.5rem;
}

.timeline-skeleton-meta {
    width: 80px;
    height: 10px;
    background-color: var(--light-gray);
    border-radius: 2px;
}

/* DSi Overlay */
.gallery-item.dsi-photo {
    position: relative;
}

.gallery-item.dsi-photo::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../images/dsi-overlay.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
    z-index: 1;
}

/* Photo Detail Page */
.photo-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.photo-detail {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-gap: 3rem;
    align-items: start;
}

.photo-image-container {
    position: relative;
}

.photo-detail-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 0;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    max-height: 80vh;
    object-fit: contain;
}

.photo-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.photo-image-container:hover .photo-actions {
    opacity: 1;
}

.action-btn {
    padding: 0.5rem 1rem;
    background: rgba(0,0,0,0.8);
    color: var(--white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.3s ease;
}

.action-btn:hover {
    background: #000000;
    color: var(--white);
}

.photo-metadata {
    padding-left: 1rem;
}

.photo-metadata h1 {
    margin-bottom: 1rem;
    font-size: 1.8rem;
    color: var(--dark-gray);
}

.photo-info {
    margin-bottom: 2rem;
}

.photo-info .image-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.photo-info .meta-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--light-gray);
}

.photo-info .meta-label {
    font-size: 0.9rem;
    color: var(--medium-gray);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.photo-info .meta-value {
    font-size: 1rem;
    color: var(--text-color);
    font-weight: 400;
    text-align: right;
}

.photo-info .image-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.photo-info .tag {
    background: var(--secondary-color);
    color: var(--white);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.photo-navigation {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--light-gray);
}

.nav-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: var(--secondary-color);
    text-decoration: none;
    border: 2px solid var(--secondary-color);
    border-radius: 0;
    font-weight: 500;
    font-family: 'Futura PT', 'Avenir Next', 'Helvetica Neue', Arial, sans-serif;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    flex: 1;
}

.nav-btn:hover {
    background: #000000;
    border-color: #000000;
    color: var(--white);
}

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

/* Responsive Photo Detail */
@media (max-width: 768px) {
    .photo-container {
        padding: 1rem;
    }

    .photo-detail {
        grid-template-columns: 1fr;
        grid-gap: 2rem;
    }

    .photo-metadata {
        padding-left: 0;
    }

    .photo-navigation {
        flex-direction: column;
    }

    .photo-actions {
        position: static;
        opacity: 1;
        flex-direction: row;
        margin-top: 1rem;
        justify-content: center;
    }
} 