/* ==========================================================================
   RUNDLE LANDSCAPING — PROJECTS GALLERY STYLES
   Phase 4A: Gallery layout, filter controls, lightbox, and animations
   ========================================================================== */

/* ═══════════════════════════════════════════
   PROJECTS — Page Hero
   ═══════════════════════════════════════════ */
.projects-hero {
    position: relative;
    padding: calc(var(--nav-height) + var(--space-5xl)) 0 var(--space-4xl);
    background: linear-gradient(135deg, var(--clr-charcoal-deep) 0%, var(--clr-charcoal) 40%, var(--clr-sage-dark) 100%);
    overflow: hidden;
    text-align: center;
}

.projects-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 25% 70%, rgba(92,122,92,0.14) 0%, transparent 55%),
        radial-gradient(ellipse at 75% 30%, rgba(196,168,130,0.08) 0%, transparent 55%);
}

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

.projects-hero .page-hero-breadcrumb {
    margin-bottom: var(--space-lg);
    justify-content: center;
}

.projects-hero-title {
    font-family: var(--font-heading);
    font-size: var(--fs-h1);
    color: white;
    margin-bottom: var(--space-md);
    letter-spacing: var(--ls-tight);
}

.projects-hero-subtitle {
    font-size: var(--fs-body-lg);
    color: rgba(255,255,255,0.65);
    line-height: var(--lh-relaxed);
    max-width: 560px;
    margin: 0 auto var(--space-xl);
}

.projects-hero-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-3xl);
    margin-top: var(--space-xl);
}

.hero-stat {
    text-align: center;
}

.hero-stat-number {
    display: block;
    font-family: var(--font-heading);
    font-size: var(--fs-h2);
    font-weight: var(--fw-bold);
    color: var(--clr-sage-light);
    line-height: var(--lh-tight);
}

.hero-stat-label {
    font-size: var(--fs-xs);
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: var(--ls-wider);
    font-weight: var(--fw-medium);
}

@media (max-width: 480px) {
    .projects-hero-stats {
        gap: var(--space-xl);
    }

    .hero-stat-number {
        font-size: var(--fs-h3);
    }
}


/* ═══════════════════════════════════════════
   PROJECTS — Filter Controls
   ═══════════════════════════════════════════ */
.projects-filters {
    background: white;
    border-bottom: 1px solid var(--clr-border);
    padding: var(--space-lg) 0;
    position: sticky;
    top: var(--nav-height);
    z-index: 90;
    transition: box-shadow var(--transition-base);
}

.projects-filters.scrolled {
    box-shadow: var(--shadow-md);
}

.filters-container {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: var(--space-xs) 0;
}

.filters-container::-webkit-scrollbar {
    display: none;
}

.filter-label {
    font-size: var(--fs-small);
    font-weight: var(--fw-semibold);
    color: var(--clr-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: var(--ls-wide);
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-lg);
    background: transparent;
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: var(--fs-small);
    font-weight: var(--fw-medium);
    color: var(--clr-text-soft);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-btn:hover {
    border-color: var(--clr-sage-muted);
    color: var(--clr-sage);
    background: rgba(92,122,92,0.04);
}

.filter-btn.active {
    background: var(--clr-sage);
    border-color: var(--clr-sage);
    color: white;
    box-shadow: 0 2px 8px rgba(92,122,92,0.25);
}

.filter-btn .filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--radius-full);
    background: rgba(0,0,0,0.06);
    font-size: 0.7rem;
    font-weight: var(--fw-semibold);
    line-height: 1;
}

.filter-btn.active .filter-count {
    background: rgba(255,255,255,0.2);
    color: white;
}

@media (max-width: 768px) {
    .filter-label {
        display: none;
    }
}


/* ═══════════════════════════════════════════
   PROJECTS — Masonry-Style Photo Grid
   ═══════════════════════════════════════════ */
.projects-gallery-section {
    padding: var(--space-3xl) 0 var(--space-5xl);
    background: var(--clr-cream);
    min-height: 60vh;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}

/* Project card — each tile in the grid */
.project-card {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 4 / 3;
    cursor: pointer;
    background: linear-gradient(135deg, var(--clr-charcoal) 0%, var(--clr-charcoal-light) 50%, var(--clr-sage-dark) 100%);
    transition: opacity var(--transition-smooth), transform var(--transition-smooth);
}

.project-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

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

/* Gradient overlay on hover */
.project-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(26,32,32,0.8) 0%,
        rgba(26,32,32,0.3) 35%,
        transparent 60%
    );
    opacity: 0;
    transition: opacity var(--transition-smooth);
}

.project-card:hover::after {
    opacity: 1;
}

/* Info overlay that slides up on hover */
.project-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-lg);
    z-index: 2;
    transform: translateY(8px);
    opacity: 0;
    transition: all var(--transition-smooth);
}

.project-card:hover .project-info {
    transform: translateY(0);
    opacity: 1;
}

.project-info-tag {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(92,122,92,0.85);
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    font-weight: var(--fw-semibold);
    color: white;
    text-transform: uppercase;
    letter-spacing: var(--ls-wide);
    margin-bottom: var(--space-xs);
}

.project-info h3 {
    font-family: var(--font-body);
    font-size: var(--fs-body);
    font-weight: var(--fw-semibold);
    color: white;
    margin-bottom: 2px;
}

.project-info span {
    font-size: var(--fs-xs);
    color: rgba(255,255,255,0.6);
}

/* Magnifying glass icon in corner */
.project-expand {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radius-full);
    z-index: 2;
    opacity: 0;
    transform: scale(0.8);
    transition: all var(--transition-smooth);
}

.project-card:hover .project-expand {
    opacity: 1;
    transform: scale(1);
}

.project-expand svg {
    width: 16px;
    height: 16px;
    color: white;
}

/* Featured card — spans 2 columns, taller */
.project-card.featured {
    grid-column: span 2;
    aspect-ratio: 2 / 1;
}

/* Empty state placeholder */
.project-card-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    color: rgba(255,255,255,0.15);
    font-size: var(--fs-xs);
}

.project-card-placeholder svg {
    width: 32px;
    height: 32px;
    opacity: 0.3;
}


/* ── Filter animation states ── */
.project-card.hiding {
    opacity: 0;
    transform: scale(0.92);
    pointer-events: none;
}

.project-card.hidden {
    display: none;
}

.project-card.showing {
    animation: cardPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes cardPopIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Empty results message */
.projects-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-5xl) var(--space-xl);
}

.projects-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-lg);
    color: var(--clr-text-muted);
    opacity: 0.3;
}

.projects-empty h3 {
    font-family: var(--font-body);
    font-size: var(--fs-h4);
    font-weight: var(--fw-semibold);
    color: var(--clr-text-soft);
    margin-bottom: var(--space-sm);
}

.projects-empty p {
    font-size: var(--fs-small);
    color: var(--clr-text-muted);
}


/* ── Grid responsive breakpoints ── */
@media (max-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .project-card.featured {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }

    /* On mobile, show info by default (no hover) */
    .project-card::after {
        opacity: 1;
        background: linear-gradient(
            to top,
            rgba(26,32,32,0.7) 0%,
            transparent 50%
        );
    }

    .project-info {
        transform: translateY(0);
        opacity: 1;
    }

    .project-expand {
        display: none;
    }
}

@media (max-width: 480px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .project-card.featured {
        grid-column: span 1;
        aspect-ratio: 16 / 9;
    }
}


/* ═══════════════════════════════════════════
   PROJECTS — Lightbox / Full-Screen Viewer
   ═══════════════════════════════════════════ */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(10,14,14,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-smooth), visibility var(--transition-smooth);
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-image-wrap {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.92);
    transition: transform var(--transition-spring);
}

.lightbox.active .lightbox-image-wrap {
    transform: scale(1);
}

.lightbox-image-wrap img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    object-fit: contain;
}

/* Caption bar below image */
.lightbox-caption {
    position: absolute;
    bottom: -48px;
    left: 0;
    right: 0;
    text-align: center;
}

.lightbox-caption h4 {
    font-family: var(--font-body);
    font-size: var(--fs-body);
    font-weight: var(--fw-semibold);
    color: white;
    margin-bottom: 2px;
}

.lightbox-caption span {
    font-size: var(--fs-xs);
    color: rgba(255,255,255,0.45);
}

/* Close button */
.lightbox-close {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-xl);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-base);
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.25);
    transform: rotate(90deg);
}

.lightbox-close svg {
    width: 20px;
    height: 20px;
    color: white;
}

/* Prev / Next arrows */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-base);
    z-index: 10;
}

.lightbox-nav:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.25);
}

.lightbox-nav svg {
    width: 20px;
    height: 20px;
    color: white;
}

.lightbox-prev {
    left: var(--space-xl);
}

.lightbox-next {
    right: var(--space-xl);
}

/* Counter (e.g. "4 / 12") */
.lightbox-counter {
    position: absolute;
    top: var(--space-lg);
    left: var(--space-xl);
    font-size: var(--fs-small);
    color: rgba(255,255,255,0.4);
    font-weight: var(--fw-medium);
    z-index: 10;
}

/* Body scroll lock when lightbox is open */
body.lightbox-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    .lightbox-prev {
        left: var(--space-sm);
    }

    .lightbox-next {
        right: var(--space-sm);
    }

    .lightbox-nav {
        width: 40px;
        height: 40px;
    }

    .lightbox-close {
        top: var(--space-md);
        right: var(--space-md);
    }
}


/* ═══════════════════════════════════════════
   PROJECTS — Bottom CTA Strip
   ═══════════════════════════════════════════ */
.projects-cta {
    padding: var(--space-5xl) 0;
    background: var(--clr-charcoal-deep);
}

.projects-cta-content {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.projects-cta-content h2 {
    font-family: var(--font-heading);
    font-size: var(--fs-h2);
    color: white;
    margin-bottom: var(--space-md);
}

.projects-cta-content p {
    color: rgba(255,255,255,0.6);
    font-size: var(--fs-body-lg);
    margin-bottom: var(--space-xl);
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.projects-cta-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.projects-cta-phone {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
    font-size: var(--fs-small);
    color: rgba(255,255,255,0.4);
}

.projects-cta-phone a {
    color: var(--clr-sage-light);
    font-weight: var(--fw-medium);
}

.projects-cta-phone a:hover {
    color: white;
}

.projects-cta-phone svg {
    width: 16px;
    height: 16px;
}


/* ═══════════════════════════════════════════
   PROJECTS — Results Counter Bar
   ═══════════════════════════════════════════ */
.projects-results-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--clr-border);
}

.results-count {
    font-size: var(--fs-small);
    color: var(--clr-text-muted);
    font-weight: var(--fw-medium);
}

.results-count strong {
    color: var(--clr-text);
    font-weight: var(--fw-semibold);
}

.results-view-toggle {
    display: flex;
    gap: var(--space-xs);
}

.view-toggle-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-base);
}

.view-toggle-btn:hover {
    border-color: var(--clr-sage-muted);
}

.view-toggle-btn.active {
    background: var(--clr-sage);
    border-color: var(--clr-sage);
}

.view-toggle-btn svg {
    width: 16px;
    height: 16px;
    color: var(--clr-text-muted);
}

.view-toggle-btn.active svg {
    color: white;
}

/* 2-column alternate layout */
.projects-grid.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.projects-grid.grid-2 .project-card {
    aspect-ratio: 16 / 10;
}

.projects-grid.grid-2 .project-card.featured {
    grid-column: span 2;
    aspect-ratio: 21 / 9;
}

@media (max-width: 768px) {
    .projects-results-bar {
        flex-direction: column;
        gap: var(--space-md);
        align-items: flex-start;
    }

    .projects-grid.grid-2 {
        grid-template-columns: 1fr;
    }

    .projects-grid.grid-2 .project-card.featured {
        grid-column: span 1;
    }
}
