/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fafafa;
    overflow-x: hidden;
}

/* Navigation */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: all 0.3s ease;
    transform: translateY(0);
}

.nav.scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.nav.nav-hidden {
    transform: translateY(-100%);
}

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

.nav-logo {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
}

.nav-logo:hover {
    color: #666;
}

.nav-logo-image {
    height: 65px;
    width: auto;
    max-width: 300px;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

.nav-logo:hover .nav-logo-image {
    opacity: 0.8;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    color: #666;
    text-decoration: none;
    font-weight: 400;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: #333;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 2px;
    background: #333;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.nav-toggle span {
    width: 25px;
    height: 2px;
    background: #333;
    margin: 3px 0;
    transition: 0.3s;
}

/* Main Content */
.main {
    margin-top: 70px;
    min-height: calc(100vh - 70px);
}

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

/* Full width container for portfolio grid */
.portfolio-container {
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Title Section */
.title-section {
    text-align: center;
    padding: 3rem 0 2rem 0;
}

.main-title {
    margin: 0 0 0.5rem 0;
    font-size: 3.5rem;
    font-weight: 700;
    color: #333;
    letter-spacing: -1px;
    max-width: 100%;
    word-wrap: break-word;
    hyphens: auto;
}

.subtitle {
    margin: 0 0 2rem 0;
    font-size: 1.1rem;
    font-weight: 300;
    color: #A8A8A8;
    text-align: center;
    letter-spacing: 0.5px;
}

/* Responsive title sizing */
@media (max-width: 1024px) {
    .main-title {
        font-size: 2.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .main-title {
        font-size: 2rem;
        line-height: 1.2;
        padding: 0 1rem;
    }
    
    .subtitle {
        font-size: 0.95rem;
        padding: 0 1rem;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 1.6rem;
        line-height: 1.1;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
}

/* Album Navigation and Meta */
.album-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 0 1rem 0;
    margin-bottom: 0.5rem;
}

/* Album Title Section (Centered, above cover) */
.album-title-section {
    text-align: center;
    padding: 1rem 0 0.5rem 0;
    margin-bottom: 0.5rem;
}

/* Album Cover Image */
.album-cover {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
}

.album-cover-container {
    position: relative;
    width: 100%;
    height: 60vh; /* Taller cover - 60% of viewport height */
    min-height: 350px; /* Minimum height for small screens */
    max-height: 700px; /* Increased maximum height */
    overflow: hidden;
}

.album-cover-picture {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
}

.album-cover-picture:hover {
    transform: scale(1.02);
    transition: transform 0.3s ease;
}

.album-cover-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover; /* This will crop the image to fit while maintaining aspect ratio */
    object-position: center; /* Center the image for better cropping */
    transition: transform 0.3s ease;
}

.breadcrumb {
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.breadcrumb-link {
    color: #666;
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb-link:hover {
    color: #333;
}

.breadcrumb-separator {
    margin: 0 0.5rem;
    color: #999;
}

.breadcrumb-current {
    color: #333;
}

.album-title {
    font-size: 2rem;
    font-weight: 300;
    margin-bottom: 0.5rem;
    color: #333;
}

.album-description {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.album-meta {
    color: #999;
    font-size: 0.9rem;
}

.album-count {
    background: #f0f0f0;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

/* Buttons */
.btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 12px 24px !important;
    border: 2px solid #ddd !important;
    border-radius: 8px !important;
    font-size: 1rem !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    background: #fff !important;
    color: #333 !important;
}

.btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.btn.primary {
    background: #3498db !important;
    color: white !important;
    border-color: #3498db !important;
}

.btn.primary:hover {
    background: #2980b9 !important;
    border-color: #2980b9 !important;
}

.btn.secondary {
    background: #95a5a6 !important;
    color: white !important;
    border-color: #95a5a6 !important;
}

.btn.secondary:hover {
    background: #7f8c8d !important;
    border-color: #7f8c8d !important;
}

/* Portfolio Grid Layouts */

/* Portfolio Grid - General container */
.portfolio-grid {
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Home Page - Simple CSS Grid */
.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
}

.home-grid .grid-item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.home-grid .grid-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.home-grid .grid-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.home-grid .grid-image:hover {
    transform: scale(1.05);
}

/* Album Page - Justified Gallery with Gaps */
.album-grid {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    line-height: 0;
    font-size: 0;
    overflow: hidden;
    background: #f8f9fa;
}

/* Justified layout images with gaps */
.album-grid .grid-image {
    display: inline-block;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    object-fit: cover;
    object-position: center;
    margin: 0;
    padding: 0;
    border: none;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    outline: none;
    vertical-align: top;
    /* Gaps will be set by JavaScript */
}

.album-grid .grid-image:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Removed hover overlay - images are now directly clickable */

/* Progressive and Lazy Loading */
.lazy-load {
    opacity: 0;
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out, filter 0.4s ease-in-out;
    transform: scale(1.02);
    filter: blur(2px);
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
}

.lazy-load.loading {
    opacity: 0.7;
    animation: loading-shimmer 1.5s infinite, pulse 2s ease-in-out infinite;
}

.lazy-load.loaded {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
    background: none;
}

.lazy-load.error {
    opacity: 0.5;
    background-color: #ffebee;
    transform: scale(1);
    filter: blur(0);
}

/* WebP support indicator for development */
.webp-supported .lazy-load::after {
    content: 'WebP';
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(76, 175, 80, 0.8);
    color: white;
    font-size: 8px;
    padding: 1px 3px;
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.webp-supported .lazy-load:hover::after {
    opacity: 1;
}

/* Critical image loading (above the fold) */
.lazy-load[data-critical="true"] {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
    background: none;
}

/* Enhanced loading animations */
@keyframes pulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 0.4;
    }
}

@keyframes loading-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

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

.lightbox.active {
    display: flex;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.lightbox-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    position: relative;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 100%;
    max-height: 100%;
}

.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    display: block;
    transition: opacity 0.3s ease;
}

.lightbox-info {
    padding: 1.5rem;
    background: white;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.lightbox-details {
    flex: 1;
}

.lightbox-title {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #333;
}

.lightbox-description {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.lightbox-album {
    font-size: 0.9rem;
    color: #999;
}

.lightbox-album-link {
    color: #666;
    text-decoration: none;
    transition: color 0.3s ease;
}

.lightbox-album-link:hover {
    color: #333;
}

.lightbox-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lightbox-download {
    background: #333;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    min-width: 120px;
}

.lightbox-download:hover {
    background: #555;
    transform: translateY(-1px);
}

.lightbox-download:active {
    transform: translateY(0);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    color: #333;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: white;
    transform: scale(1.1);
}

.lightbox-close {
    top: 20px;
    right: 20px;
    font-size: 2rem;
}

.lightbox-prev {
    left: -80px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: -80px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
}

.lightbox-loading.active {
    display: block;
}

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

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
}

.empty-state h2 {
    font-size: 2rem;
    font-weight: 300;
    margin-bottom: 1rem;
    color: #333;
}

/* Responsive Design */
@media (min-width: 768px) {
    .hero-title {
        font-size: 4rem;
    }
    
    .album-title {
        font-size: 2.5rem;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 3rem;
    }
    
    .hero {
        margin: 0 -3rem 4rem -3rem;
    }
    
    .album-cover-container {
        height: 50vh; /* Slightly smaller on tablets */
        min-height: 320px;
        max-height: 580px;
    }
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .album-navigation {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1.5rem 0 1rem 0;
    }
    
    .album-title-section {
        padding: 0.75rem 0 0.25rem 0;
    }
    
    .album-title {
        font-size: 2rem;
    }
    
    .album-cover {
        margin-bottom: 2rem;
    }
    
    .album-cover-container {
        height: 40vh; /* Smaller on mobile */
        min-height: 250px;
        max-height: 450px;
    }
    
    .album-cover-picture:hover {
        transform: scale(1.01); /* Subtle hover effect on mobile */
    }
    
    .gallery-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
}

/* Mobile Navigation */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 2rem;
        gap: 1rem;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .nav-menu.active {
        transform: translateY(0);
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .nav-toggle.active span:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }
    
    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .nav-toggle.active span:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .album-title {
        font-size: 2rem;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
    }
    
    .lightbox-info {
        flex-direction: column;
        gap: 1rem;
    }
    
    .lightbox-actions {
        flex-direction: row;
        justify-content: center;
    }
    
    .lightbox-download {
        min-width: auto;
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
}

/* Animation for grid items - disabled for justified layout */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ensure proper styling for different grid types */
.home-grid .grid-item {
    display: block !important; /* Show containers for home grid */
}

.album-grid .grid-item {
    display: none !important; /* Hide containers for justified album grid */
}