/* Gallery Page Styles for Redemption Renovations */

/* Gallery Hero Section */
.gallery-hero {
    position: relative;
    background: linear-gradient(135deg, rgba(29, 138, 155, 0.95) 0%, rgba(31, 31, 31, 0.9) 100%);
    padding: clamp(10rem, 15vh, 14rem) clamp(1.5rem, 6vw, 4rem) clamp(4rem, 8vh, 6rem);
    text-align: center;
    color: var(--white);
    overflow: hidden;
}

.gallery-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.gallery-hero-content {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    z-index: 1;
}

.gallery-hero h1 {
    font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: clamp(2.5rem, 5vw, 4rem);
    line-height: 1.2;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.gallery-hero p {
    font-size: clamp(1.1rem, 2vw, 1.3rem);
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    max-width: 600px;
    margin: 0 auto;
}

/* Gallery Main Section */
.gallery-main {
    background: #f8f9fa;
    padding: 4rem 1.5rem;
    min-height: 60vh;
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    align-items: start;
}

@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1025px) {
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Loading State */
.loading-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(29, 138, 155, 0.2);
    border-top-color: #1d8a9b;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Project Card */
.project-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.project-card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #f0f0f0;
    position: relative;
}

.project-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
    display: block;
}

.project-card:hover .project-card-image img {
    transform: scale(1.05);
}

.project-card-body {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.project-card-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f1f1f;
    margin: 0 0 0.5rem 0;
}

.project-card-type {
    display: inline-block;
    background: #e8f4f6;
    color: #1d8a9b;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.project-card-meta {
    font-size: 0.9rem;
    color: #666;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.project-card-images-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #1d8a9b;
    font-weight: 500;
}

/* Project Modal */
.project-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: relative;
    background: white;
    border-radius: 16px;
    max-width: 1000px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* Modal Carousel */
.modal-carousel {
    position: relative;
    background: #000;
}

.carousel-container {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.carousel-track {
    display: flex;
    height: 100%;
    transition: transform 0.5s ease;
}

.carousel-slide {
    min-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1f1f1f;
    font-weight: 300;
}

.carousel-btn:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
}

.carousel-btn.prev {
    left: 1rem;
}

.carousel-btn.next {
    right: 1rem;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.5);
}

.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.carousel-dot.active {
    background: white;
    width: 12px;
    height: 12px;
}

/* Modal Content */
.modal-content {
    padding: 2rem;
}

.modal-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: #1f1f1f;
    margin: 0 0 1rem 0;
}

.modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #f0f0f0;
}

.modal-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.modal-meta-label {
    font-size: 0.85rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.modal-meta-value {
    font-size: 1rem;
    color: #1f1f1f;
    font-weight: 500;
}

.modal-description {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #4c5c62;
}

.modal-description p {
    margin: 0 0 1rem 0;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-container {
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
        margin-top: auto;
    }
    
    .carousel-container {
        aspect-ratio: 4 / 3;
    }
    
    .carousel-btn {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
    
    .carousel-btn.prev {
        left: 0.5rem;
    }
    
    .carousel-btn.next {
        right: 0.5rem;
    }
    
    .modal-content {
        padding: 1.5rem;
    }
    
    .modal-title {
        font-size: 1.5rem;
    }
}

/* Filter Bar */
.gallery-filter-section {
    background: var(--white);
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(31, 31, 31, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(31, 31, 31, 0.05);
}

.gallery-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
}

.filter-btn {
    font-family: 'Outfit', 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.65rem 1.5rem;
    border-radius: 999px;
    border: 2px solid rgba(29, 138, 155, 0.2);
    background: var(--white);
    color: var(--charcoal);
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    border-color: var(--teal);
    background: rgba(29, 138, 155, 0.08);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: var(--teal);
    color: var(--white);
    border-color: var(--teal);
    box-shadow: 0 4px 12px rgba(29, 138, 155, 0.3);
}

/* Gallery Main Section */
.gallery-main {
    background: var(--warm-gray);
    padding: clamp(3rem, 6vw, 5rem) 1.5rem;
}

/* Masonry Grid */
.gallery-masonry {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    max-width: var(--max-width);
    margin: 0 auto;
}

@media (min-width: 768px) {
    .gallery-masonry {
        grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    }
}

@media (min-width: 1200px) {
    .gallery-masonry {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Gallery Cards */
.gallery-card {
    background: var(--white);
    border-radius: calc(var(--radius) * 1.3);
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(31, 31, 31, 0.08);
    transition: all 0.4s ease;
    cursor: pointer;
}

.gallery-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 48px rgba(31, 31, 31, 0.16);
}

.gallery-card-image {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
    margin: 0;
}

.gallery-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-card:hover .gallery-card-image img {
    transform: scale(1.08);
}

.gallery-card-content {
    padding: 1.75rem;
}

.gallery-card-tag {
    display: inline-block;
    background: rgba(29, 138, 155, 0.12);
    color: var(--teal);
    padding: 0.4rem 1rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
}

.gallery-card-content h3 {
    font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
    color: var(--charcoal);
    line-height: 1.3;
}

.gallery-card-content p {
    color: #4c5c62;
    line-height: 1.6;
    margin-bottom: 1.25rem;
}

.gallery-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.9rem;
    color: #5c6a70;
    padding-top: 1rem;
    border-top: 1px solid rgba(31, 31, 31, 0.08);
}

.gallery-card-meta span {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Hidden state for filtering */
.gallery-card.hidden {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .gallery-filter-section {
        padding: 1.5rem 1rem;
    }

    .filter-btn {
        font-size: 0.85rem;
        padding: 0.55rem 1.2rem;
    }

    .gallery-masonry {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .gallery-card-image {
        height: 240px;
    }

    .gallery-card-content {
        padding: 1.5rem;
    }

    .gallery-card-content h3 {
        font-size: 1.25rem;
    }
}

/* Loading state */
.gallery-loading {
    text-align: center;
    padding: 4rem 2rem;
}

.gallery-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(29, 138, 155, 0.2);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

.gallery-empty h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--charcoal);
}

/* Empty and Error States */
.empty-state,
.error-state {
    text-align: center;
    padding: 4rem 2rem;
    grid-column: 1 / -1;
}

.empty-state h2,
.error-state h2 {
    font-family: 'Montserrat', sans-serif;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.empty-state h2 {
    color: #333;
}

.error-state h2 {
    color: #dc3545;
}

.empty-state p,
.error-state p {
    color: #666;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.empty-state a,
.error-state button {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: #1d8a9b;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

.empty-state a:hover,
.error-state button:hover {
    background: #156b78;
}

/* Print styles */
@media print {
    .gallery-filter-section,
    .mobile-wrapper,
    .mobile-menu-button,
    #navbar-container {
        display: none;
    }
    
    .gallery-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}